core: always use gulong to store signal handler ids
We inconsistently use gulong,guint,int types to store signal handler id, but the type returned by g_signal_connect() is a gulong. This has no practical consequences because a int/guint is enough to store the value, however it is better to use a consistent type, also because nm_clear_g_signal_handler() accepts a pointer to the signal id and thus it must be always called with the same pointer type.
This commit is contained in:
@@ -208,7 +208,7 @@ nm_clear_g_source (guint *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
nm_clear_g_signal_handler (gpointer self, guint *id)
|
nm_clear_g_signal_handler (gpointer self, gulong *id)
|
||||||
{
|
{
|
||||||
if (id && *id) {
|
if (id && *id) {
|
||||||
g_signal_handler_disconnect (self, *id);
|
g_signal_handler_disconnect (self, *id);
|
||||||
|
@@ -71,8 +71,8 @@ typedef struct Supplicant {
|
|||||||
NMSupplicantInterface *iface;
|
NMSupplicantInterface *iface;
|
||||||
|
|
||||||
/* signal handler ids */
|
/* signal handler ids */
|
||||||
guint iface_error_id;
|
gulong iface_error_id;
|
||||||
guint iface_state_id;
|
gulong iface_state_id;
|
||||||
|
|
||||||
/* Timeouts and idles */
|
/* Timeouts and idles */
|
||||||
guint iface_con_error_cb_id;
|
guint iface_con_error_cb_id;
|
||||||
@@ -117,7 +117,7 @@ typedef struct {
|
|||||||
/* DCB */
|
/* DCB */
|
||||||
DcbWait dcb_wait;
|
DcbWait dcb_wait;
|
||||||
guint dcb_timeout_id;
|
guint dcb_timeout_id;
|
||||||
guint dcb_carrier_id;
|
gulong dcb_carrier_id;
|
||||||
} NMDeviceEthernetPrivate;
|
} NMDeviceEthernetPrivate;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@@ -47,7 +47,7 @@ G_DEFINE_TYPE (NMDeviceMacvlan, nm_device_macvlan, NM_TYPE_DEVICE)
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int parent_ifindex;
|
int parent_ifindex;
|
||||||
guint parent_state_id;
|
gulong parent_state_id;
|
||||||
NMDevice *parent;
|
NMDevice *parent;
|
||||||
NMPlatformLnkMacvlan props;
|
NMPlatformLnkMacvlan props;
|
||||||
} NMDeviceMacvlanPrivate;
|
} NMDeviceMacvlanPrivate;
|
||||||
|
@@ -49,8 +49,8 @@ G_DEFINE_TYPE (NMDeviceVlan, nm_device_vlan, NM_TYPE_DEVICE)
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMDevice *parent;
|
NMDevice *parent;
|
||||||
guint parent_state_id;
|
gulong parent_state_id;
|
||||||
guint parent_hwaddr_id;
|
gulong parent_hwaddr_id;
|
||||||
int vlan_id;
|
int vlan_id;
|
||||||
} NMDeviceVlanPrivate;
|
} NMDeviceVlanPrivate;
|
||||||
|
|
||||||
|
@@ -174,7 +174,7 @@ typedef struct {
|
|||||||
NMDevice *slave;
|
NMDevice *slave;
|
||||||
gboolean slave_is_enslaved;
|
gboolean slave_is_enslaved;
|
||||||
gboolean configure;
|
gboolean configure;
|
||||||
guint watch_id;
|
gulong watch_id;
|
||||||
} SlaveInfo;
|
} SlaveInfo;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -354,7 +354,7 @@ typedef struct _NMDevicePrivate {
|
|||||||
NMDevice * master;
|
NMDevice * master;
|
||||||
gboolean is_enslaved;
|
gboolean is_enslaved;
|
||||||
gboolean master_ready_handled;
|
gboolean master_ready_handled;
|
||||||
guint master_ready_id;
|
gulong master_ready_id;
|
||||||
|
|
||||||
/* slave management */
|
/* slave management */
|
||||||
gboolean is_master;
|
gboolean is_master;
|
||||||
|
@@ -39,8 +39,8 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMBusManager * dbus_mgr;
|
NMBusManager * dbus_mgr;
|
||||||
guint new_conn_id;
|
gulong new_conn_id;
|
||||||
guint dis_conn_id;
|
gulong dis_conn_id;
|
||||||
GHashTable * signal_handlers;
|
GHashTable * signal_handlers;
|
||||||
} NMDhcpListenerPrivate;
|
} NMDhcpListenerPrivate;
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ typedef struct {
|
|||||||
|
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
|
|
||||||
guint bus_closed_id;
|
gulong bus_closed_id;
|
||||||
guint reconnect_id;
|
guint reconnect_id;
|
||||||
} NMBusManagerPrivate;
|
} NMBusManagerPrivate;
|
||||||
|
|
||||||
|
@@ -1726,20 +1726,20 @@ static void
|
|||||||
_connect_manager_signal (NMPolicy *policy, const char *name, gpointer callback)
|
_connect_manager_signal (NMPolicy *policy, const char *name, gpointer callback)
|
||||||
{
|
{
|
||||||
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
|
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
|
||||||
guint id;
|
gulong id;
|
||||||
|
|
||||||
id = g_signal_connect (priv->manager, name, callback, policy);
|
id = g_signal_connect (priv->manager, name, callback, policy);
|
||||||
priv->manager_ids = g_slist_prepend (priv->manager_ids, GUINT_TO_POINTER (id));
|
priv->manager_ids = g_slist_prepend (priv->manager_ids, (gpointer) id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_connect_settings_signal (NMPolicy *policy, const char *name, gpointer callback)
|
_connect_settings_signal (NMPolicy *policy, const char *name, gpointer callback)
|
||||||
{
|
{
|
||||||
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
|
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
|
||||||
guint id;
|
gulong id;
|
||||||
|
|
||||||
id = g_signal_connect (priv->settings, name, callback, policy);
|
id = g_signal_connect (priv->settings, name, callback, policy);
|
||||||
priv->settings_ids = g_slist_prepend (priv->settings_ids, GUINT_TO_POINTER (id));
|
priv->settings_ids = g_slist_prepend (priv->settings_ids, (gpointer) id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NMPolicy *
|
NMPolicy *
|
||||||
@@ -1889,11 +1889,11 @@ dispose (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (iter = priv->manager_ids; iter; iter = g_slist_next (iter))
|
for (iter = priv->manager_ids; iter; iter = g_slist_next (iter))
|
||||||
g_signal_handler_disconnect (priv->manager, GPOINTER_TO_UINT (iter->data));
|
g_signal_handler_disconnect (priv->manager, (gulong) iter->data);
|
||||||
g_clear_pointer (&priv->manager_ids, g_slist_free);
|
g_clear_pointer (&priv->manager_ids, g_slist_free);
|
||||||
|
|
||||||
for (iter = priv->settings_ids; iter; iter = g_slist_next (iter))
|
for (iter = priv->settings_ids; iter; iter = g_slist_next (iter))
|
||||||
g_signal_handler_disconnect (priv->settings, GPOINTER_TO_UINT (iter->data));
|
g_signal_handler_disconnect (priv->settings, (gulong) iter->data);
|
||||||
g_clear_pointer (&priv->settings_ids, g_slist_free);
|
g_clear_pointer (&priv->settings_ids, g_slist_free);
|
||||||
|
|
||||||
for (iter = priv->dev_ids; iter; iter = g_slist_next (iter)) {
|
for (iter = priv->dev_ids; iter; iter = g_slist_next (iter)) {
|
||||||
|
@@ -322,7 +322,7 @@ nmtstp_wait_for_signal (guint timeout_ms)
|
|||||||
{
|
{
|
||||||
WaitForSignalData data = { 0 };
|
WaitForSignalData data = { 0 };
|
||||||
|
|
||||||
guint id_link, id_ip4_address, id_ip6_address, id_ip4_route, id_ip6_route;
|
gulong id_link, id_ip4_address, id_ip6_address, id_ip4_route, id_ip6_route;
|
||||||
|
|
||||||
data.loop = g_main_loop_new (NULL, FALSE);
|
data.loop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int handler_id;
|
gulong handler_id;
|
||||||
const char *name;
|
const char *name;
|
||||||
NMPlatformSignalChangeType change_type;
|
NMPlatformSignalChangeType change_type;
|
||||||
gint received_count;
|
gint received_count;
|
||||||
|
@@ -73,7 +73,7 @@ typedef struct {
|
|||||||
NMBusManager *bus_mgr;
|
NMBusManager *bus_mgr;
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
gboolean connection_is_private;
|
gboolean connection_is_private;
|
||||||
guint on_disconnected_id;
|
gulong on_disconnected_id;
|
||||||
|
|
||||||
GHashTable *requests;
|
GHashTable *requests;
|
||||||
} NMSecretAgentPrivate;
|
} NMSecretAgentPrivate;
|
||||||
|
@@ -152,8 +152,8 @@ typedef struct {
|
|||||||
char *file;
|
char *file;
|
||||||
GFileMonitor *monitor;
|
GFileMonitor *monitor;
|
||||||
GFileMonitor *dhcp_monitor;
|
GFileMonitor *dhcp_monitor;
|
||||||
guint monitor_id;
|
gulong monitor_id;
|
||||||
guint dhcp_monitor_id;
|
gulong dhcp_monitor_id;
|
||||||
GDBusProxy *hostnamed_proxy;
|
GDBusProxy *hostnamed_proxy;
|
||||||
} hostname;
|
} hostname;
|
||||||
} NMSettingsPrivate;
|
} NMSettingsPrivate;
|
||||||
|
@@ -89,14 +89,14 @@ typedef struct {
|
|||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
GDBusInterfaceSkeleton *interface;
|
GDBusInterfaceSkeleton *interface;
|
||||||
GCancellable *cancellable;
|
GCancellable *cancellable;
|
||||||
guint signal_id;
|
gulong signal_id;
|
||||||
} dbus;
|
} dbus;
|
||||||
|
|
||||||
GHashTable *connections; /* uuid::connection */
|
GHashTable *connections; /* uuid::connection */
|
||||||
gboolean initialized;
|
gboolean initialized;
|
||||||
|
|
||||||
GFileMonitor *ifcfg_monitor;
|
GFileMonitor *ifcfg_monitor;
|
||||||
guint ifcfg_monitor_id;
|
gulong ifcfg_monitor_id;
|
||||||
} SettingsPluginIfcfgPrivate;
|
} SettingsPluginIfcfgPrivate;
|
||||||
|
|
||||||
static SettingsPluginIfcfg *settings_plugin_ifcfg_get (void);
|
static SettingsPluginIfcfg *settings_plugin_ifcfg_get (void);
|
||||||
|
@@ -56,7 +56,7 @@ typedef struct {
|
|||||||
|
|
||||||
gboolean initialized;
|
gboolean initialized;
|
||||||
GFileMonitor *monitor;
|
GFileMonitor *monitor;
|
||||||
guint monitor_id;
|
gulong monitor_id;
|
||||||
|
|
||||||
NMConfig *config;
|
NMConfig *config;
|
||||||
} SettingsPluginKeyfilePrivate;
|
} SettingsPluginKeyfilePrivate;
|
||||||
|
@@ -40,8 +40,8 @@ typedef struct {
|
|||||||
GSList *plugins;
|
GSList *plugins;
|
||||||
GFileMonitor *monitor_etc;
|
GFileMonitor *monitor_etc;
|
||||||
GFileMonitor *monitor_lib;
|
GFileMonitor *monitor_lib;
|
||||||
guint monitor_id_etc;
|
gulong monitor_id_etc;
|
||||||
guint monitor_id_lib;
|
gulong monitor_id_lib;
|
||||||
|
|
||||||
/* This is only used for services that don't support multiple
|
/* This is only used for services that don't support multiple
|
||||||
* connections, to guard access to them. */
|
* connections, to guard access to them. */
|
||||||
|
Reference in New Issue
Block a user