summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-10-19 14:26:52 +0200
committerThomas Haller <thaller@redhat.com>2015-10-19 15:50:08 +0200
commit971a7611bdab8da2c1f6f3ef199f99999202b93a (patch)
tree138620d894a818aac99d19eb066cd4134ca0168f
parent31b594561c08be233ef1e91734d9efe979d65954 (diff)
downloadNetworkManager-971a7611bdab8da2c1f6f3ef199f99999202b93a.tar.gz
device: refactor using nm_clear_g_source() for priv->carrier_wait_id
(cherry picked from commit c89fd1ea76421ab63bbc227e4c12924f197e6585)
-rw-r--r--src/devices/nm-device.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 68d38cfc54..531e45f9ca 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1325,9 +1325,7 @@ nm_device_set_carrier (NMDevice *self, gboolean carrier)
link_disconnect_action_cancel (self);
klass->carrier_changed (self, TRUE);
- if (priv->carrier_wait_id) {
- g_source_remove (priv->carrier_wait_id);
- priv->carrier_wait_id = 0;
+ if (nm_clear_g_source (&priv->carrier_wait_id)) {
nm_device_remove_pending_action (self, "carrier wait", TRUE);
_carrier_wait_check_queued_act_request (self);
}
@@ -7106,9 +7104,7 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware)
* a timeout is reached.
*/
if (nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) {
- if (priv->carrier_wait_id)
- g_source_remove (priv->carrier_wait_id);
- else
+ if (!nm_clear_g_source (&priv->carrier_wait_id))
nm_device_add_pending_action (self, "carrier wait", TRUE);
priv->carrier_wait_id = g_timeout_add_seconds (5, carrier_wait_timeout, self);
}
@@ -9238,10 +9234,7 @@ dispose (GObject *object)
g_hash_table_remove_all (priv->available_connections);
- if (priv->carrier_wait_id) {
- g_source_remove (priv->carrier_wait_id);
- priv->carrier_wait_id = 0;
- }
+ nm_clear_g_source (&priv->carrier_wait_id);
_clear_queued_act_request (priv);