merge: branch 'bg/helper-macros-bgo760149'

https://bugzilla.gnome.org/show_bug.cgi?id=760149
This commit is contained in:
Beniamino Galvani 2016-01-06 21:28:30 +01:00
commit 0b5264d400
40 changed files with 128 additions and 289 deletions

View file

@ -1748,10 +1748,7 @@ dispose (GObject *object)
{
NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object);
if (priv->notify_id) {
g_source_remove (priv->notify_id);
priv->notify_id = 0;
}
nm_clear_g_source (&priv->notify_id);
g_slist_free_full (priv->notify_items, (GDestroyNotify) notify_item_free);
priv->notify_items = NULL;

View file

@ -208,7 +208,7 @@ nm_clear_g_source (guint *id)
}
static inline gboolean
nm_clear_g_signal_handler (gpointer self, guint *id)
nm_clear_g_signal_handler (gpointer self, gulong *id)
{
if (id && *id) {
g_signal_handler_disconnect (self, *id);

View file

@ -267,7 +267,7 @@ pppoe_vcc_config (NMDeviceAdsl *self)
return FALSE;
/* Watch for the 'nas' interface going away */
g_signal_connect (nm_platform_get (), NM_PLATFORM_SIGNAL_LINK_CHANGED,
g_signal_connect (NM_PLATFORM_GET, NM_PLATFORM_SIGNAL_LINK_CHANGED,
G_CALLBACK (link_changed_cb),
self);
@ -508,7 +508,7 @@ adsl_cleanup (NMDeviceAdsl *self)
nm_exported_object_clear_and_unexport (&priv->ppp_manager);
}
g_signal_handlers_disconnect_by_func (nm_platform_get (), G_CALLBACK (link_changed_cb), self);
g_signal_handlers_disconnect_by_func (NM_PLATFORM_GET, G_CALLBACK (link_changed_cb), self);
if (priv->brfd >= 0) {
close (priv->brfd);

View file

@ -137,10 +137,7 @@ sdp_search_cleanup (NMBluez5DunContext *context)
context->sdp_session = NULL;
}
if (context->sdp_watch_id) {
g_source_remove (context->sdp_watch_id);
context->sdp_watch_id = 0;
}
nm_clear_g_source (&context->sdp_watch_id);
}
static void

View file

@ -632,10 +632,7 @@ component_added (NMDevice *device, GObject *component)
g_free (base);
/* Got the modem */
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
nm_clear_g_source (&priv->timeout_id);
/* Can only accept the modem in stage2, but since the interface matched
* what we were expecting, don't let anything else claim the modem either.
@ -703,10 +700,7 @@ check_connect_continue (NMDeviceBt *self)
dun ? "DUN" : (pan ? "PAN" : "unknown"));
/* Kill the connect timeout since we're connected now */
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
nm_clear_g_source (&priv->timeout_id);
if (pan) {
/* Bluez says we're connected now. Start IP config. */
@ -911,10 +905,7 @@ deactivate (NMDevice *device)
if (priv->bt_type != NM_BT_CAPABILITY_NONE)
nm_bluez_device_disconnect (priv->bt_device);
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
nm_clear_g_source (&priv->timeout_id);
priv->bt_type = NM_BT_CAPABILITY_NONE;
@ -1104,10 +1095,7 @@ dispose (GObject *object)
{
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object);
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
nm_clear_g_source (&priv->timeout_id);
g_signal_handlers_disconnect_matched (priv->bt_device, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object);

View file

@ -71,8 +71,8 @@ typedef struct Supplicant {
NMSupplicantInterface *iface;
/* signal handler ids */
guint iface_error_id;
guint iface_state_id;
gulong iface_error_id;
gulong iface_state_id;
/* Timeouts and idles */
guint iface_con_error_cb_id;
@ -117,7 +117,7 @@ typedef struct {
/* DCB */
DcbWait dcb_wait;
guint dcb_timeout_id;
guint dcb_carrier_id;
gulong dcb_carrier_id;
} NMDeviceEthernetPrivate;
enum {
@ -457,15 +457,8 @@ remove_supplicant_timeouts (NMDeviceEthernet *self)
{
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
if (priv->supplicant.con_timeout_id) {
g_source_remove (priv->supplicant.con_timeout_id);
priv->supplicant.con_timeout_id = 0;
}
if (priv->supplicant_timeout_id) {
g_source_remove (priv->supplicant_timeout_id);
priv->supplicant_timeout_id = 0;
}
nm_clear_g_source (&priv->supplicant.con_timeout_id);
nm_clear_g_source (&priv->supplicant_timeout_id);
}
static void
@ -1030,10 +1023,7 @@ dcb_timeout_cleanup (NMDevice *device)
{
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
if (priv->dcb_timeout_id) {
g_source_remove (priv->dcb_timeout_id);
priv->dcb_timeout_id = 0;
}
nm_clear_g_source (&priv->dcb_timeout_id);
}
static void
@ -1041,10 +1031,7 @@ dcb_carrier_cleanup (NMDevice *device)
{
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
if (priv->dcb_carrier_id) {
g_signal_handler_disconnect (device, priv->dcb_carrier_id);
priv->dcb_carrier_id = 0;
}
nm_clear_g_signal_handler (device, &priv->dcb_carrier_id);
}
static void dcb_state (NMDevice *device, gboolean timeout);
@ -1393,10 +1380,7 @@ deactivate (NMDevice *device)
/* Clear wired secrets tries when deactivating */
clear_secrets_tries (device);
if (priv->pppoe_wait_id) {
g_source_remove (priv->pppoe_wait_id);
priv->pppoe_wait_id = 0;
}
nm_clear_g_source (&priv->pppoe_wait_id);
if (priv->pending_ip4_config) {
g_object_unref (priv->pending_ip4_config);
@ -1635,10 +1619,7 @@ dispose (GObject *object)
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (object);
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
if (priv->pppoe_wait_id) {
g_source_remove (priv->pppoe_wait_id);
priv->pppoe_wait_id = 0;
}
nm_clear_g_source (&priv->pppoe_wait_id);
dcb_timeout_cleanup (NM_DEVICE (self));
dcb_carrier_cleanup (NM_DEVICE (self));

View file

@ -47,7 +47,7 @@ G_DEFINE_TYPE (NMDeviceMacvlan, nm_device_macvlan, NM_TYPE_DEVICE)
typedef struct {
int parent_ifindex;
guint parent_state_id;
gulong parent_state_id;
NMDevice *parent;
NMPlatformLnkMacvlan props;
} NMDeviceMacvlanPrivate;

View file

@ -49,8 +49,8 @@ G_DEFINE_TYPE (NMDeviceVlan, nm_device_vlan, NM_TYPE_DEVICE)
typedef struct {
NMDevice *parent;
guint parent_state_id;
guint parent_hwaddr_id;
gulong parent_state_id;
gulong parent_hwaddr_id;
int vlan_id;
} NMDeviceVlanPrivate;

View file

@ -174,7 +174,7 @@ typedef struct {
NMDevice *slave;
gboolean slave_is_enslaved;
gboolean configure;
guint watch_id;
gulong watch_id;
} SlaveInfo;
typedef struct {
@ -354,7 +354,7 @@ typedef struct _NMDevicePrivate {
NMDevice * master;
gboolean is_enslaved;
gboolean master_ready_handled;
guint master_ready_id;
gulong master_ready_id;
/* slave management */
gboolean is_master;
@ -3920,10 +3920,7 @@ dhcp4_cleanup (NMDevice *self, CleanupType cleanup_type, gboolean release)
if (priv->dhcp4_client) {
/* Stop any ongoing DHCP transaction on this device */
if (priv->dhcp4_state_sigid) {
g_signal_handler_disconnect (priv->dhcp4_client, priv->dhcp4_state_sigid);
priv->dhcp4_state_sigid = 0;
}
nm_clear_g_signal_handler (priv->dhcp4_client, &priv->dhcp4_state_sigid);
nm_device_remove_pending_action (self, PENDING_ACTION_DHCP4, FALSE);
@ -4614,10 +4611,7 @@ dhcp6_cleanup (NMDevice *self, CleanupType cleanup_type, gboolean release)
nm_clear_g_source (&priv->dhcp6_restart_id);
if (priv->dhcp6_client) {
if (priv->dhcp6_state_sigid) {
g_signal_handler_disconnect (priv->dhcp6_client, priv->dhcp6_state_sigid);
priv->dhcp6_state_sigid = 0;
}
nm_clear_g_signal_handler (priv->dhcp6_client, &priv->dhcp6_state_sigid);
if ( cleanup_type == CLEANUP_TYPE_DECONFIGURE
|| cleanup_type == CLEANUP_TYPE_REMOVED)
@ -5149,10 +5143,7 @@ linklocal6_cleanup (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
if (priv->linklocal6_timeout_id) {
g_source_remove (priv->linklocal6_timeout_id);
priv->linklocal6_timeout_id = 0;
}
nm_clear_g_source (&priv->linklocal6_timeout_id);
}
static void
@ -5640,15 +5631,8 @@ addrconf6_cleanup (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
if (priv->rdisc_changed_id) {
g_signal_handler_disconnect (priv->rdisc, priv->rdisc_changed_id);
priv->rdisc_changed_id = 0;
}
if (priv->rdisc_timeout_id) {
g_signal_handler_disconnect (priv->rdisc, priv->rdisc_timeout_id);
priv->rdisc_timeout_id = 0;
}
nm_clear_g_signal_handler (priv->rdisc, &priv->rdisc_changed_id);
nm_clear_g_signal_handler (priv->rdisc, &priv->rdisc_timeout_id);
nm_device_remove_pending_action (self, PENDING_ACTION_AUTOCONF6, FALSE);
@ -6471,10 +6455,7 @@ arp_cleanup (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
if (priv->arp_round2_id) {
g_source_remove (priv->arp_round2_id);
priv->arp_round2_id = 0;
}
nm_clear_g_source (&priv->arp_round2_id);
}
static void
@ -6727,10 +6708,7 @@ dnsmasq_cleanup (NMDevice *self)
if (!priv->dnsmasq_manager)
return;
if (priv->dnsmasq_state_id) {
g_signal_handler_disconnect (priv->dnsmasq_manager, priv->dnsmasq_state_id);
priv->dnsmasq_state_id = 0;
}
nm_clear_g_signal_handler (priv->dnsmasq_manager, &priv->dnsmasq_state_id);
nm_dnsmasq_manager_stop (priv->dnsmasq_manager);
g_object_unref (priv->dnsmasq_manager);
@ -10216,15 +10194,8 @@ dispose (GObject *object)
g_hash_table_remove_all (priv->ip6_saved_properties);
if (priv->recheck_assume_id) {
g_source_remove (priv->recheck_assume_id);
priv->recheck_assume_id = 0;
}
if (priv->recheck_available.call_id) {
g_source_remove (priv->recheck_available.call_id);
priv->recheck_available.call_id = 0;
}
nm_clear_g_source (&priv->recheck_assume_id);
nm_clear_g_source (&priv->recheck_available.call_id);
link_disconnect_action_cancel (self);

View file

@ -252,15 +252,8 @@ teamd_cleanup (NMDevice *device, gboolean free_tdc)
{
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (device);
if (priv->teamd_process_watch) {
g_source_remove (priv->teamd_process_watch);
priv->teamd_process_watch = 0;
}
if (priv->teamd_timeout) {
g_source_remove (priv->teamd_timeout);
priv->teamd_timeout = 0;
}
nm_clear_g_source (&priv->teamd_process_watch);
nm_clear_g_source (&priv->teamd_timeout);
if (priv->teamd_pid > 0) {
nm_utils_kill_child_async (priv->teamd_pid, SIGTERM, LOGD_TEAM, "teamd", 2000, NULL, NULL);

View file

@ -500,10 +500,7 @@ deactivate (NMDevice *device)
int ifindex = nm_device_get_ifindex (device);
NM80211Mode old_mode = priv->mode;
if (priv->periodic_source_id) {
g_source_remove (priv->periodic_source_id);
priv->periodic_source_id = 0;
}
nm_clear_g_source (&priv->periodic_source_id);
cleanup_association_attempt (self, TRUE);
@ -1428,10 +1425,7 @@ cancel_pending_scan (NMDeviceWifi *self)
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
if (priv->pending_scan_id) {
g_source_remove (priv->pending_scan_id);
priv->pending_scan_id = 0;
}
nm_clear_g_source (&priv->pending_scan_id);
}
static void
@ -1646,15 +1640,8 @@ remove_supplicant_timeouts (NMDeviceWifi *self)
{
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
if (priv->sup_timeout_id) {
g_source_remove (priv->sup_timeout_id);
priv->sup_timeout_id = 0;
}
if (priv->link_timeout_id) {
g_source_remove (priv->link_timeout_id);
priv->link_timeout_id = 0;
}
nm_clear_g_source (&priv->sup_timeout_id);
nm_clear_g_source (&priv->link_timeout_id);
}
static void
@ -2811,10 +2798,7 @@ device_state_changed (NMDevice *device,
if (priv->sup_iface)
supplicant_interface_release (self);
if (priv->periodic_source_id) {
g_source_remove (priv->periodic_source_id);
priv->periodic_source_id = 0;
}
nm_clear_g_source (&priv->periodic_source_id);
cleanup_association_attempt (self, TRUE);
cleanup_supplicant_failures (self);
@ -2947,10 +2931,7 @@ dispose (GObject *object)
NMDeviceWifi *self = NM_DEVICE_WIFI (object);
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
if (priv->periodic_source_id) {
g_source_remove (priv->periodic_source_id);
priv->periodic_source_id = 0;
}
nm_clear_g_source (&priv->periodic_source_id);
cleanup_association_attempt (self, TRUE);
supplicant_interface_release (self);

View file

@ -194,10 +194,7 @@ modem_manager_name_owner_changed (MMManager *modem_manager,
gchar *name_owner;
/* Quit poking, if any */
if (self->priv->mm_launch_id) {
g_source_remove (self->priv->mm_launch_id);
self->priv->mm_launch_id = 0;
}
nm_clear_g_source (&self->priv->mm_launch_id);
name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (modem_manager));
if (!name_owner) {
@ -435,10 +432,7 @@ dispose (GObject *object)
{
NMModemManager *self = NM_MODEM_MANAGER (object);
if (self->priv->mm_launch_id) {
g_source_remove (self->priv->mm_launch_id);
self->priv->mm_launch_id = 0;
}
nm_clear_g_source (&self->priv->mm_launch_id);
modem_manager_clear_signals (self);
g_clear_object (&self->priv->modem_manager);

View file

@ -238,10 +238,7 @@ timeout_cleanup (NMDhcpClient *self)
{
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
nm_clear_g_source (&priv->timeout_id);
}
static void
@ -249,10 +246,7 @@ watch_cleanup (NMDhcpClient *self)
{
NMDhcpClientPrivate *priv = NM_DHCP_CLIENT_GET_PRIVATE (self);
if (priv->watch_id) {
g_source_remove (priv->watch_id);
priv->watch_id = 0;
}
nm_clear_g_source (&priv->watch_id);
}
void

View file

@ -39,8 +39,8 @@
typedef struct {
NMBusManager * dbus_mgr;
guint new_conn_id;
guint dis_conn_id;
gulong new_conn_id;
gulong dis_conn_id;
GHashTable * signal_handlers;
} NMDhcpListenerPrivate;
@ -211,14 +211,8 @@ dispose (GObject *object)
{
NMDhcpListenerPrivate *priv = NM_DHCP_LISTENER_GET_PRIVATE (object);
if (priv->new_conn_id) {
g_signal_handler_disconnect (priv->dbus_mgr, priv->new_conn_id);
priv->new_conn_id = 0;
}
if (priv->dis_conn_id) {
g_signal_handler_disconnect (priv->dbus_mgr, priv->dis_conn_id);
priv->dis_conn_id = 0;
}
nm_clear_g_signal_handler (priv->dbus_mgr, &priv->new_conn_id);
nm_clear_g_signal_handler (priv->dbus_mgr, &priv->dis_conn_id);
priv->dbus_mgr = NULL;
g_clear_pointer (&priv->signal_handlers, g_hash_table_destroy);

View file

@ -189,10 +189,7 @@ nm_dns_plugin_child_kill (NMDnsPlugin *self)
{
NMDnsPluginPrivate *priv = NM_DNS_PLUGIN_GET_PRIVATE (self);
if (priv->watch_id) {
g_source_remove (priv->watch_id);
priv->watch_id = 0;
}
nm_clear_g_source (&priv->watch_id);
if (priv->pid) {
nm_utils_kill_child_sync (priv->pid, SIGTERM, LOGD_DNS, priv->progname, NULL, 1000, 0);

View file

@ -385,10 +385,7 @@ nm_dnsmasq_manager_stop (NMDnsMasqManager *manager)
priv = NM_DNSMASQ_MANAGER_GET_PRIVATE (manager);
if (priv->dm_watch_id) {
g_source_remove (priv->dm_watch_id);
priv->dm_watch_id = 0;
}
nm_clear_g_source (&priv->dm_watch_id);
if (priv->pid) {
nm_utils_kill_child_async (priv->pid, SIGTERM, LOGD_SHARING, "dnsmasq", 2000, NULL, NULL);

View file

@ -61,7 +61,7 @@ typedef struct {
GDBusProxy *proxy;
guint bus_closed_id;
gulong bus_closed_id;
guint reconnect_id;
} NMBusManagerPrivate;

View file

@ -243,10 +243,7 @@ _reschedule_periodic_checks (NMConnectivity *self, gboolean force_reschedule)
priv->initial_check_obsoleted = FALSE;
}
} else {
if (priv->check_id) {
g_source_remove (priv->check_id);
priv->check_id = 0;
}
nm_clear_g_source (&priv->check_id);
}
if (priv->check_id)
return;

View file

@ -1389,7 +1389,7 @@ nm_default_route_manager_init (NMDefaultRouteManager *self)
priv->entries_ip4 = g_ptr_array_new_full (0, (GDestroyNotify) _entry_free);
priv->entries_ip6 = g_ptr_array_new_full (0, (GDestroyNotify) _entry_free);
priv->platform = g_object_ref (nm_platform_get ());
priv->platform = g_object_ref (NM_PLATFORM_GET);
g_signal_connect (priv->platform, NM_PLATFORM_SIGNAL_IP4_ADDRESS_CHANGED, G_CALLBACK (_platform_changed_cb), self);
g_signal_connect (priv->platform, NM_PLATFORM_SIGNAL_IP6_ADDRESS_CHANGED, G_CALLBACK (_platform_changed_cb), self);
g_signal_connect (priv->platform, NM_PLATFORM_SIGNAL_IP4_ROUTE_CHANGED, G_CALLBACK (_platform_changed_cb), self);

View file

@ -39,9 +39,9 @@
G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, NM_TYPE_EXPORTED_OBJECT)
#define NM_IP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP4_CONFIG, NMIP4ConfigPrivate))
#define NM_IP4_CONFIG_GET_PRIVATE(o) ((o)->priv)
typedef struct {
typedef struct _NMIP4ConfigPrivate {
gboolean never_default;
guint32 gateway;
gboolean has_gateway;
@ -2120,7 +2120,10 @@ nm_ip4_config_equal (const NMIP4Config *a, const NMIP4Config *b)
static void
nm_ip4_config_init (NMIP4Config *config)
{
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
NMIP4ConfigPrivate *priv;
priv = G_TYPE_INSTANCE_GET_PRIVATE (config, NM_TYPE_IP4_CONFIG, NMIP4ConfigPrivate);
config->priv = priv;
priv->addresses = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP4Address));
priv->routes = g_array_new (FALSE, FALSE, sizeof (NMPlatformIP4Route));
@ -2136,7 +2139,8 @@ nm_ip4_config_init (NMIP4Config *config)
static void
finalize (GObject *object)
{
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
NMIP4Config *self = NM_IP4_CONFIG (object);
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (self);
g_array_unref (priv->addresses);
g_array_unref (priv->routes);
@ -2156,7 +2160,7 @@ get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
NMIP4Config *config = NM_IP4_CONFIG (object);
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
switch (prop_id) {
case PROP_IFINDEX:
@ -2322,7 +2326,8 @@ set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
NMIP4Config *self = NM_IP4_CONFIG (object);
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (self);
switch (prop_id) {
case PROP_IFINDEX:

View file

@ -31,8 +31,13 @@
#define NM_IS_IP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IP4_CONFIG))
#define NM_IP4_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP4_CONFIG, NMIP4ConfigClass))
struct _NMIP4ConfigPrivate;
struct _NMIP4Config {
NMExportedObject parent;
/* private */
struct _NMIP4ConfigPrivate *priv;
};
typedef struct {

View file

@ -38,9 +38,9 @@
G_DEFINE_TYPE (NMIP6Config, nm_ip6_config, NM_TYPE_EXPORTED_OBJECT)
#define NM_IP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP6_CONFIG, NMIP6ConfigPrivate))
#define NM_IP6_CONFIG_GET_PRIVATE(o) ((o)->priv)
typedef struct {
typedef struct _NMIP6ConfigPrivate {
gboolean never_default;
struct in6_addr gateway;
GArray *addresses;
@ -1874,7 +1874,10 @@ nm_ip6_config_equal (const NMIP6Config *a, const NMIP6Config *b)
static void
nm_ip6_config_init (NMIP6Config *config)
{
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
NMIP6ConfigPrivate *priv;
priv = G_TYPE_INSTANCE_GET_PRIVATE (config, NM_TYPE_IP6_CONFIG, NMIP6ConfigPrivate);
config->priv = priv;
priv->addresses = g_array_new (FALSE, TRUE, sizeof (NMPlatformIP6Address));
priv->routes = g_array_new (FALSE, TRUE, sizeof (NMPlatformIP6Route));
@ -1888,7 +1891,8 @@ nm_ip6_config_init (NMIP6Config *config)
static void
finalize (GObject *object)
{
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object);
NMIP6Config *self = NM_IP6_CONFIG (object);
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (self);
g_array_unref (priv->addresses);
g_array_unref (priv->routes);
@ -1925,7 +1929,7 @@ get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
NMIP6Config *config = NM_IP6_CONFIG (object);
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object);
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
switch (prop_id) {
case PROP_IFINDEX:
@ -2074,7 +2078,8 @@ set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object);
NMIP6Config *config = NM_IP6_CONFIG (object);
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
switch (prop_id) {
case PROP_IFINDEX:

View file

@ -33,8 +33,13 @@
#define NM_IS_IP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IP6_CONFIG))
#define NM_IP6_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP6_CONFIG, NMIP6ConfigClass))
struct _NMIP6ConfigPrivate;
struct _NMIP6Config {
NMExportedObject parent;
/* private */
struct _NMIP6ConfigPrivate *priv;
};
typedef struct {

View file

@ -4330,7 +4330,7 @@ nm_manager_start (NMManager *self, GError **error)
if (!nm_settings_start (priv->settings, error))
return FALSE;
g_signal_connect (nm_platform_get (),
g_signal_connect (NM_PLATFORM_GET,
NM_PLATFORM_SIGNAL_LINK_CHANGED,
G_CALLBACK (platform_link_cb),
self);
@ -5347,10 +5347,7 @@ dispose (GObject *object)
g_assert (priv->devices == NULL);
if (priv->ac_cleanup_id) {
g_source_remove (priv->ac_cleanup_id);
priv->ac_cleanup_id = 0;
}
nm_clear_g_source (&priv->ac_cleanup_id);
while (priv->active_connections)
active_connection_remove (manager, NM_ACTIVE_CONNECTION (priv->active_connections->data));
@ -5403,10 +5400,7 @@ dispose (GObject *object)
if (priv->fw_monitor) {
g_signal_handlers_disconnect_by_func (priv->fw_monitor, firmware_dir_changed, manager);
if (priv->fw_changed_id) {
g_source_remove (priv->fw_changed_id);
priv->fw_changed_id = 0;
}
nm_clear_g_source (&priv->fw_changed_id);
g_file_monitor_cancel (priv->fw_monitor);
g_clear_object (&priv->fw_monitor);
@ -5419,10 +5413,7 @@ dispose (GObject *object)
nm_device_factory_manager_for_each_factory (_deinit_device_factory, manager);
if (priv->timestamp_update_id) {
g_source_remove (priv->timestamp_update_id);
priv->timestamp_update_id = 0;
}
nm_clear_g_source (&priv->timestamp_update_id);
G_OBJECT_CLASS (nm_manager_parent_class)->dispose (object);
}

View file

@ -73,7 +73,7 @@ typedef struct {
NMDnsManager *dns_manager;
gulong config_changed_id;
gint reset_retries_id; /* idle handler for resetting the retries count */
guint reset_retries_id; /* idle handler for resetting the retries count */
char *orig_hostname; /* hostname at NM start time */
char *cur_hostname; /* hostname we want to assign */
@ -1726,20 +1726,20 @@ static void
_connect_manager_signal (NMPolicy *policy, const char *name, gpointer callback)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
guint id;
gulong id;
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
_connect_settings_signal (NMPolicy *policy, const char *name, gpointer callback)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
guint id;
gulong id;
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 *
@ -1889,11 +1889,11 @@ dispose (GObject *object)
}
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);
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);
for (iter = priv->dev_ids; iter; iter = g_slist_next (iter)) {
@ -1911,10 +1911,7 @@ dispose (GObject *object)
connections = nm_manager_get_active_connections (priv->manager);
g_assert (connections == NULL);
if (priv->reset_retries_id) {
g_source_remove (priv->reset_retries_id);
priv->reset_retries_id = 0;
}
nm_clear_g_source (&priv->reset_retries_id);
g_clear_pointer (&priv->orig_hostname, g_free);
g_clear_pointer (&priv->cur_hostname, g_free);

View file

@ -35,7 +35,7 @@ add_signal_full (const char *name, NMPlatformSignalChangeType change_type, GCall
data->name = name;
data->change_type = change_type;
data->received_count = 0;
data->handler_id = g_signal_connect (nm_platform_get (), name, callback, data);
data->handler_id = g_signal_connect (NM_PLATFORM_GET, name, callback, data);
data->ifindex = ifindex;
data->ifname = ifname;
@ -104,7 +104,7 @@ _free_signal (const char *file, int line, const char *func, SignalData *data)
if (data->received_count != 0)
g_error ("NMPlatformSignalAssert: %s:%d, %s(): failure to free non-accepted signal: "SIGNAL_DATA_FMT, file, line, func, SIGNAL_DATA_ARG (data));
g_signal_handler_disconnect (nm_platform_get (), data->handler_id);
g_signal_handler_disconnect (NM_PLATFORM_GET, data->handler_id);
g_free (data);
}
@ -322,7 +322,7 @@ nmtstp_wait_for_signal (guint timeout_ms)
{
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);
@ -1549,6 +1549,6 @@ main (int argc, char **argv)
nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME));
g_object_unref (nm_platform_get ());
g_object_unref (NM_PLATFORM_GET);
return result;
}

View file

@ -39,7 +39,7 @@
/*********************************************************************************************/
typedef struct {
int handler_id;
gulong handler_id;
const char *name;
NMPlatformSignalChangeType change_type;
gint received_count;

View file

@ -222,10 +222,7 @@ remove_timeout_handler (NMPPPManager *manager)
{
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
if (priv->ppp_timeout_handler) {
g_source_remove (priv->ppp_timeout_handler);
priv->ppp_timeout_handler = 0;
}
nm_clear_g_source (&priv->ppp_timeout_handler);
}
static void
@ -1125,10 +1122,7 @@ _ppp_cleanup (NMPPPManager *manager)
cancel_get_secrets (manager);
if (priv->monitor_id) {
g_source_remove (priv->monitor_id);
priv->monitor_id = 0;
}
nm_clear_g_source (&priv->monitor_id);
if (priv->monitor_fd >= 0) {
/* Get the stats one last time */
@ -1137,15 +1131,8 @@ _ppp_cleanup (NMPPPManager *manager)
priv->monitor_fd = -1;
}
if (priv->ppp_timeout_handler) {
g_source_remove (priv->ppp_timeout_handler);
priv->ppp_timeout_handler = 0;
}
if (priv->ppp_watch_id) {
g_source_remove (priv->ppp_watch_id);
priv->ppp_watch_id = 0;
}
nm_clear_g_source (&priv->ppp_timeout_handler);
nm_clear_g_source (&priv->ppp_watch_id);
}
/***********************************************************/

View file

@ -367,10 +367,7 @@ dispose (GObject *object)
{
NMFakeRDiscPrivate *priv = NM_FAKE_RDISC_GET_PRIVATE (object);
if (priv->receive_ra_id) {
g_source_remove (priv->receive_ra_id);
priv->receive_ra_id = 0;
}
nm_clear_g_source (&priv->receive_ra_id);
g_slist_free_full (priv->ras, fake_ra_free);
priv->ras = NULL;

View file

@ -355,10 +355,7 @@ dispose (GObject *object)
NMLNDPRDisc *rdisc = NM_LNDP_RDISC (object);
NMLNDPRDiscPrivate *priv = NM_LNDP_RDISC_GET_PRIVATE (rdisc);
if (priv->event_id) {
g_source_remove (priv->event_id);
priv->event_id = 0;
}
nm_clear_g_source (&priv->event_id);
g_clear_pointer (&priv->event_channel, g_io_channel_unref);
if (priv->ndp) {

View file

@ -623,10 +623,7 @@ check_timestamps (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap changed)
guint32 never = G_MAXINT32;
guint32 nextevent = never;
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
nm_clear_g_source (&priv->timeout_id);
clean_gateways (rdisc, now, &changed, &nextevent);
clean_addresses (rdisc, now, &changed, &nextevent);
@ -701,10 +698,7 @@ dispose (GObject *object)
nm_clear_g_source (&priv->send_rs_id);
g_clear_pointer (&priv->last_send_rs_error, g_free);
if (priv->timeout_id) {
g_source_remove (priv->timeout_id);
priv->timeout_id = 0;
}
nm_clear_g_source (&priv->timeout_id);
G_OBJECT_CLASS (nm_rdisc_parent_class)->dispose (object);
}

View file

@ -73,7 +73,7 @@ typedef struct {
NMBusManager *bus_mgr;
GDBusConnection *connection;
gboolean connection_is_private;
guint on_disconnected_id;
gulong on_disconnected_id;
GHashTable *requests;
} NMSecretAgentPrivate;

View file

@ -2616,10 +2616,7 @@ dispose (GObject *object)
}
}
if (priv->updated_idle_id) {
g_source_remove (priv->updated_idle_id);
priv->updated_idle_id = 0;
}
nm_clear_g_source (&priv->updated_idle_id);
/* Disconnect handlers.
* changed_cb() has to be disconnected *before* nm_connection_clear_secrets(),

View file

@ -152,8 +152,8 @@ typedef struct {
char *file;
GFileMonitor *monitor;
GFileMonitor *dhcp_monitor;
guint monitor_id;
guint dhcp_monitor_id;
gulong monitor_id;
gulong dhcp_monitor_id;
GDBusProxy *hostnamed_proxy;
} hostname;
} NMSettingsPrivate;

View file

@ -144,7 +144,7 @@ devtimeout_expired (gpointer user_data)
nm_log_info (LOGD_SETTINGS, "Device for connection '%s' did not appear before timeout",
nm_connection_get_id (NM_CONNECTION (self)));
g_signal_handler_disconnect (nm_platform_get (), priv->devtimeout_link_changed_handler);
g_signal_handler_disconnect (NM_PLATFORM_GET, priv->devtimeout_link_changed_handler);
priv->devtimeout_link_changed_handler = 0;
priv->devtimeout_timeout_id = 0;
@ -188,7 +188,7 @@ nm_ifcfg_connection_check_devtimeout (NMIfcfgConnection *self)
devtimeout, ifname, nm_connection_get_id (NM_CONNECTION (self)));
priv->devtimeout_link_changed_handler =
g_signal_connect (nm_platform_get (), NM_PLATFORM_SIGNAL_LINK_CHANGED,
g_signal_connect (NM_PLATFORM_GET, NM_PLATFORM_SIGNAL_LINK_CHANGED,
G_CALLBACK (link_changed), self);
priv->devtimeout_timeout_id = g_timeout_add_seconds (devtimeout, devtimeout_expired, self);
}
@ -277,10 +277,7 @@ path_watch_stop (NMIfcfgConnection *self)
ih = _get_inotify_helper (priv);
if (priv->ih_event_id) {
g_signal_handler_disconnect (ih, priv->ih_event_id);
priv->ih_event_id = 0;
}
nm_clear_g_signal_handler (ih, &priv->ih_event_id);
if (priv->file_wd >= 0) {
nm_inotify_helper_remove_watch (ih, priv->file_wd);
@ -516,15 +513,8 @@ dispose (GObject *object)
path_watch_stop (NM_IFCFG_CONNECTION (object));
if (priv->devtimeout_link_changed_handler) {
g_signal_handler_disconnect (nm_platform_get (),
priv->devtimeout_link_changed_handler);
priv->devtimeout_link_changed_handler = 0;
}
if (priv->devtimeout_timeout_id) {
g_source_remove (priv->devtimeout_timeout_id);
priv->devtimeout_timeout_id = 0;
}
nm_clear_g_signal_handler (NM_PLATFORM_GET, &priv->devtimeout_link_changed_handler);
nm_clear_g_source (&priv->devtimeout_timeout_id);
g_clear_object (&priv->inotify_helper);

View file

@ -89,14 +89,14 @@ typedef struct {
GDBusConnection *connection;
GDBusInterfaceSkeleton *interface;
GCancellable *cancellable;
guint signal_id;
gulong signal_id;
} dbus;
GHashTable *connections; /* uuid::connection */
gboolean initialized;
GFileMonitor *ifcfg_monitor;
guint ifcfg_monitor_id;
gulong ifcfg_monitor_id;
} SettingsPluginIfcfgPrivate;
static SettingsPluginIfcfg *settings_plugin_ifcfg_get (void);

View file

@ -56,7 +56,7 @@ typedef struct {
gboolean initialized;
GFileMonitor *monitor;
guint monitor_id;
gulong monitor_id;
NMConfig *config;
} SettingsPluginKeyfilePrivate;
@ -589,10 +589,7 @@ dispose (GObject *object)
SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (object);
if (priv->monitor) {
if (priv->monitor_id) {
g_signal_handler_disconnect (priv->monitor, priv->monitor_id);
priv->monitor_id = 0;
}
nm_clear_g_signal_handler (priv->monitor, &priv->monitor_id);
g_file_monitor_cancel (priv->monitor);
g_clear_object (&priv->monitor);

View file

@ -345,10 +345,7 @@ dispose (GObject *object)
{
NMSupplicantManagerPrivate *priv = NM_SUPPLICANT_MANAGER_GET_PRIVATE (object);
if (priv->die_count_reset_id) {
g_source_remove (priv->die_count_reset_id);
priv->die_count_reset_id = 0;
}
nm_clear_g_source (&priv->die_count_reset_id);
if (priv->cancellable) {
g_cancellable_cancel (priv->cancellable);

View file

@ -1171,10 +1171,7 @@ nm_vpn_connection_config_maybe_complete (NMVpnConnection *self,
}
}
if (priv->connect_timeout) {
g_source_remove (priv->connect_timeout);
priv->connect_timeout = 0;
}
nm_clear_g_source (&priv->connect_timeout);
if (success) {
print_vpn_config (self);
@ -2433,10 +2430,7 @@ dispose (GObject *object)
g_clear_pointer (&priv->connect_hash, g_variant_unref);
if (priv->connect_timeout) {
g_source_remove (priv->connect_timeout);
priv->connect_timeout = 0;
}
nm_clear_g_source (&priv->connect_timeout);
dispatcher_cleanup (self);

View file

@ -40,8 +40,8 @@ typedef struct {
GSList *plugins;
GFileMonitor *monitor_etc;
GFileMonitor *monitor_lib;
guint monitor_id_etc;
guint monitor_id_lib;
gulong monitor_id_etc;
gulong monitor_id_lib;
/* This is only used for services that don't support multiple
* connections, to guard access to them. */