all: use G_CALLBACK() macro instead of plain cast

This commit is contained in:
Thomas Haller 2021-08-05 09:06:12 +02:00
parent 5e6b50ec73
commit 3f6365f5d0
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
9 changed files with 55 additions and 55 deletions

View file

@ -8266,7 +8266,7 @@ activate_stage1_device_prepare(NMDevice *self)
priv->master_ready_id =
g_signal_connect(active,
"notify::" NM_ACTIVE_CONNECTION_INT_MASTER_READY,
(GCallback) master_ready_cb,
G_CALLBACK(master_ready_cb),
self);
}
return;

View file

@ -272,7 +272,7 @@ _dns_config_ip_data_new(NMDnsConfigData * data,
g_signal_connect(ip_config,
NM_IS_IP4_CONFIG(ip_config) ? "notify::" NM_IP4_CONFIG_DNS_PRIORITY
: "notify::" NM_IP6_CONFIG_DNS_PRIORITY,
(GCallback) _ip_config_dns_priority_changed,
G_CALLBACK(_ip_config_dns_priority_changed),
ip_data);
_ASSERT_dns_config_ip_data(ip_data);

View file

@ -208,12 +208,12 @@ _set_settings_connection(NMActiveConnection *self, NMSettingsConnection *sett_co
if (sett_conn) {
g_signal_connect(sett_conn,
NM_SETTINGS_CONNECTION_UPDATED_INTERNAL,
(GCallback) _settings_connection_updated,
G_CALLBACK(_settings_connection_updated),
self);
if (nm_active_connection_get_activation_type(self) == NM_ACTIVATION_TYPE_EXTERNAL)
g_signal_connect(sett_conn,
NM_SETTINGS_CONNECTION_FLAGS_CHANGED,
(GCallback) _settings_connection_flags_changed,
G_CALLBACK(_settings_connection_flags_changed),
self);
}
@ -851,7 +851,7 @@ nm_active_connection_set_master(NMActiveConnection *self, NMActiveConnection *ma
priv->master = g_object_ref(master);
g_signal_connect(priv->master,
"notify::" NM_ACTIVE_CONNECTION_STATE,
(GCallback) master_state_cb,
G_CALLBACK(master_state_cb),
self);
check_master_ready(self);
@ -883,7 +883,7 @@ _set_activation_type(NMActiveConnection *self, NMActivationType activation_type)
if (activation_type == NM_ACTIVATION_TYPE_EXTERNAL)
g_signal_connect(priv->settings_connection.obj,
NM_SETTINGS_CONNECTION_FLAGS_CHANGED,
(GCallback) _settings_connection_flags_changed,
G_CALLBACK(_settings_connection_flags_changed),
self);
else
g_signal_handlers_disconnect_by_func(priv->settings_connection.obj,
@ -1018,7 +1018,7 @@ unwatch_parent(NMActiveConnection *self, gboolean unref)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self);
g_signal_handlers_disconnect_by_func(priv->parent, (GCallback) parent_state_cb, self);
g_signal_handlers_disconnect_by_func(priv->parent, G_CALLBACK(parent_state_cb), self);
if (unref)
g_object_weak_unref((GObject *) priv->parent, parent_destroyed, self);
priv->parent = NULL;
@ -1042,7 +1042,7 @@ nm_active_connection_set_parent(NMActiveConnection *self, NMActiveConnection *pa
priv->parent = parent;
g_signal_connect(priv->parent,
"notify::" NM_ACTIVE_CONNECTION_STATE,
(GCallback) parent_state_cb,
G_CALLBACK(parent_state_cb),
self);
g_object_weak_ref((GObject *) priv->parent, parent_destroyed, self);
}
@ -1522,7 +1522,7 @@ dispose(GObject *object)
_device_cleanup(self);
if (priv->master) {
g_signal_handlers_disconnect_by_func(priv->master, (GCallback) master_state_cb, self);
g_signal_handlers_disconnect_by_func(priv->master, G_CALLBACK(master_state_cb), self);
}
g_clear_object(&priv->master);

View file

@ -4751,7 +4751,7 @@ active_connection_parent_active(NMActiveConnection *active,
NMSettingsConnection *sett_conn;
NMDevice * parent;
g_signal_handlers_disconnect_by_func(active, (GCallback) active_connection_parent_active, self);
g_signal_handlers_disconnect_by_func(active, G_CALLBACK(active_connection_parent_active), self);
if (!parent_ac) {
_LOGW(LOGD_CORE,
@ -4926,7 +4926,7 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError **
/* We can't realize now; defer until the parent device is ready. */
g_signal_connect(active,
NM_ACTIVE_CONNECTION_PARENT_ACTIVE,
(GCallback) active_connection_parent_active,
G_CALLBACK(active_connection_parent_active),
self);
nm_active_connection_set_parent(active, parent_ac);
} else {
@ -6164,7 +6164,7 @@ sleep_devices_add(NMManager *self, NMDevice *device, gboolean suspending)
g_hash_table_insert(priv->sleep_devices,
g_object_ref(device),
suspending ? nm_sleep_monitor_inhibit_take(priv->sleep_monitor) : NULL);
g_signal_connect(device, "notify::" NM_DEVICE_STATE, (GCallback) device_sleep_cb, self);
g_signal_connect(device, "notify::" NM_DEVICE_STATE, G_CALLBACK(device_sleep_cb), self);
return TRUE;
}

View file

@ -913,7 +913,7 @@ update_system_hostname(NMPolicy *self, const char *msg)
if (wait) {
g_signal_connect(info->device,
NM_DEVICE_DNS_LOOKUP_DONE,
(GCallback) device_dns_lookup_done,
G_CALLBACK(device_dns_lookup_done),
self);
return;
}
@ -2222,30 +2222,30 @@ devices_list_register(NMPolicy *self, NMDevice *device)
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
/* Connect state-changed with _after, so that the handler is invoked after other handlers. */
g_signal_connect_after(device, NM_DEVICE_STATE_CHANGED, (GCallback) device_state_changed, priv);
g_signal_connect_after(device, NM_DEVICE_STATE_CHANGED, G_CALLBACK(device_state_changed), priv);
g_signal_connect(device,
NM_DEVICE_IP4_CONFIG_CHANGED,
(GCallback) device_ip_config_changed,
G_CALLBACK(device_ip_config_changed),
priv);
g_signal_connect(device,
NM_DEVICE_IP6_CONFIG_CHANGED,
(GCallback) device_ip_config_changed,
G_CALLBACK(device_ip_config_changed),
priv);
g_signal_connect(device,
NM_DEVICE_IP6_PREFIX_DELEGATED,
(GCallback) device_ip6_prefix_delegated,
G_CALLBACK(device_ip6_prefix_delegated),
priv);
g_signal_connect(device,
NM_DEVICE_IP6_SUBNET_NEEDED,
(GCallback) device_ip6_subnet_needed,
G_CALLBACK(device_ip6_subnet_needed),
priv);
g_signal_connect(device,
"notify::" NM_DEVICE_AUTOCONNECT,
(GCallback) device_autoconnect_changed,
G_CALLBACK(device_autoconnect_changed),
priv);
g_signal_connect(device,
NM_DEVICE_RECHECK_AUTO_ACTIVATE,
(GCallback) device_recheck_auto_activate,
G_CALLBACK(device_recheck_auto_activate),
priv);
}
@ -2800,49 +2800,49 @@ constructed(GObject *object)
g_signal_connect(priv->hostname_manager,
"notify::" NM_HOSTNAME_MANAGER_HOSTNAME,
(GCallback) hostname_changed,
G_CALLBACK(hostname_changed),
priv);
g_signal_connect(priv->manager,
"notify::" NM_MANAGER_SLEEPING,
(GCallback) sleeping_changed,
G_CALLBACK(sleeping_changed),
priv);
g_signal_connect(priv->manager,
"notify::" NM_MANAGER_NETWORKING_ENABLED,
(GCallback) sleeping_changed,
G_CALLBACK(sleeping_changed),
priv);
g_signal_connect(priv->manager,
NM_MANAGER_INTERNAL_DEVICE_ADDED,
(GCallback) device_added,
G_CALLBACK(device_added),
priv);
g_signal_connect(priv->manager,
NM_MANAGER_INTERNAL_DEVICE_REMOVED,
(GCallback) device_removed,
G_CALLBACK(device_removed),
priv);
g_signal_connect(priv->manager,
NM_MANAGER_ACTIVE_CONNECTION_ADDED,
(GCallback) active_connection_added,
G_CALLBACK(active_connection_added),
priv);
g_signal_connect(priv->manager,
NM_MANAGER_ACTIVE_CONNECTION_REMOVED,
(GCallback) active_connection_removed,
G_CALLBACK(active_connection_removed),
priv);
g_signal_connect(priv->settings,
NM_SETTINGS_SIGNAL_CONNECTION_ADDED,
(GCallback) connection_added,
G_CALLBACK(connection_added),
priv);
g_signal_connect(priv->settings,
NM_SETTINGS_SIGNAL_CONNECTION_UPDATED,
(GCallback) connection_updated,
G_CALLBACK(connection_updated),
priv);
g_signal_connect(priv->settings,
NM_SETTINGS_SIGNAL_CONNECTION_REMOVED,
(GCallback) connection_removed,
G_CALLBACK(connection_removed),
priv);
g_signal_connect(priv->settings,
NM_SETTINGS_SIGNAL_CONNECTION_FLAGS_CHANGED,
(GCallback) connection_flags_changed,
G_CALLBACK(connection_flags_changed),
priv);
g_signal_connect(priv->agent_mgr,

View file

@ -104,11 +104,11 @@ SignalData *add_signal_full(const char * name,
int ifindex,
const char * ifname);
#define add_signal(name, change_type, callback) \
add_signal_full(name, change_type, (GCallback) callback, 0, NULL)
add_signal_full(name, change_type, G_CALLBACK(callback), 0, NULL)
#define add_signal_ifindex(name, change_type, callback, ifindex) \
add_signal_full(name, change_type, (GCallback) callback, ifindex, NULL)
add_signal_full(name, change_type, G_CALLBACK(callback), ifindex, NULL)
#define add_signal_ifname(name, change_type, callback, ifname) \
add_signal_full(name, change_type, (GCallback) callback, 0, ifname)
add_signal_full(name, change_type, G_CALLBACK(callback), 0, ifname)
void _accept_signal(const char *file, int line, const char *func, SignalData *data);
void
_accept_signals(const char *file, int line, const char *func, SignalData *data, int min, int max);

View file

@ -62,7 +62,7 @@ test_device_added(void)
devices = nm_client_get_devices(client);
g_assert(devices->len == 0);
g_signal_connect(client, "notify::devices", (GCallback) devices_notify_cb, &notified);
g_signal_connect(client, "notify::devices", G_CALLBACK(devices_notify_cb), &notified);
/* Tell the test service to add a new device */
nmtstc_service_add_device(sinfo, client, "AddWiredDevice", "eth0");
@ -149,11 +149,11 @@ test_device_added_signal_after_init(void)
devices = nm_client_get_devices(client);
g_assert(devices->len == 0);
g_signal_connect(client, NM_CLIENT_DEVICE_ADDED, (GCallback) device_sai_added_cb, &result);
g_signal_connect(client, NM_CLIENT_DEVICE_ADDED, G_CALLBACK(device_sai_added_cb), &result);
g_signal_connect(client,
"notify::" NM_CLIENT_DEVICES,
(GCallback) devices_sai_notify_cb,
G_CALLBACK(devices_sai_notify_cb),
&result);
/* Tell the test service to add a new device */
@ -307,10 +307,10 @@ test_wifi_ap_added_removed(void)
g_variant_get(ret, "(o)", &expected_path);
g_variant_unref(ret);
g_signal_connect(wifi, "access-point-added", (GCallback) wifi_ap_added_cb, &info);
g_signal_connect(wifi, "access-point-added", G_CALLBACK(wifi_ap_added_cb), &info);
info.quit_count = 1;
g_signal_connect(wifi, "notify::access-points", (GCallback) wifi_ap_add_notify_cb, &info);
g_signal_connect(wifi, "notify::access-points", G_CALLBACK(wifi_ap_add_notify_cb), &info);
info.quit_count++;
/* Wait for libnm to find the AP */
@ -340,10 +340,10 @@ test_wifi_ap_added_removed(void)
g_assert_no_error(error);
nm_clear_pointer(&ret, g_variant_unref);
g_signal_connect(wifi, "access-point-removed", (GCallback) wifi_ap_removed_cb, &info);
g_signal_connect(wifi, "access-point-removed", G_CALLBACK(wifi_ap_removed_cb), &info);
info.quit_count = 1;
g_signal_connect(wifi, "notify::access-points", (GCallback) wifi_ap_remove_notify_cb, &info);
g_signal_connect(wifi, "notify::access-points", G_CALLBACK(wifi_ap_remove_notify_cb), &info);
info.quit_count++;
/* Wait for libnm to find the AP */
@ -463,9 +463,9 @@ test_devices_array(void)
g_assert(ret);
g_variant_unref(ret);
g_signal_connect(client, "device-removed", (GCallback) da_device_removed_cb, &info);
g_signal_connect(client, "device-removed", G_CALLBACK(da_device_removed_cb), &info);
g_signal_connect(client, "notify::devices", (GCallback) da_devices_notify_cb, &info);
g_signal_connect(client, "notify::devices", G_CALLBACK(da_devices_notify_cb), &info);
info.quit_count = 2;
/* Wait for libnm to notice the changes */

View file

@ -5013,7 +5013,7 @@ test_connection_changed_signal(void)
connection = new_test_connection();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
/* Add new setting */
@ -5039,7 +5039,7 @@ test_setting_connection_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_con = (NMSettingConnection *) nm_setting_connection_new();
@ -5075,7 +5075,7 @@ test_setting_bond_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_bond = (NMSettingBond *) nm_setting_bond_new();
@ -5101,7 +5101,7 @@ test_setting_ip4_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new();
@ -5177,7 +5177,7 @@ test_setting_ip6_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new();
@ -5244,7 +5244,7 @@ test_setting_vlan_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_vlan = (NMSettingVlan *) nm_setting_vlan_new();
@ -5279,7 +5279,7 @@ test_setting_vpn_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_vpn = (NMSettingVpn *) nm_setting_vpn_new();
@ -5306,7 +5306,7 @@ test_setting_wired_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_wired = (NMSettingWired *) nm_setting_wired_new();
@ -5329,7 +5329,7 @@ test_setting_wireless_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_wifi = (NMSettingWireless *) nm_setting_wireless_new();
@ -5350,7 +5350,7 @@ test_setting_wireless_security_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new();
@ -5417,7 +5417,7 @@ test_setting_802_1x_changed_signal(void)
connection = nm_simple_connection_new();
g_signal_connect(connection,
NM_CONNECTION_CHANGED,
(GCallback) test_connection_changed_cb,
G_CALLBACK(test_connection_changed_cb),
&changed);
s_8021x = (NMSetting8021x *) nm_setting_802_1x_new();

View file

@ -1238,7 +1238,7 @@ _nmtst_main_loop_quit_on_notify(GObject *object, GParamSpec *pspec, gpointer use
g_main_loop_quit(loop);
}
#define nmtst_main_loop_quit_on_notify ((GCallback) _nmtst_main_loop_quit_on_notify)
#define nmtst_main_loop_quit_on_notify (G_CALLBACK(_nmtst_main_loop_quit_on_notify))
#define nmtst_main_context_iterate_until_full(context, timeout_msec, poll_msec, condition) \
({ \