diff options
author | Thomas Haller <thaller@redhat.com> | 2016-10-12 19:49:46 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-10-24 10:14:02 +0200 |
commit | 21d7aa92044b458028e1968cd09ec015edf977ec (patch) | |
tree | 8919c0af4e3187a344eeb2aeb51e66becbcf2629 /libnm/nm-device-wifi.c | |
parent | c4198d45e3cd4b3896a80db6cd0ec2cd161aa28f (diff) | |
download | NetworkManager-21d7aa92044b458028e1968cd09ec015edf977ec.tar.gz |
libnm: minor refactoring by using g_clear_object() and nm_str_not_empty()
Diffstat (limited to 'libnm/nm-device-wifi.c')
-rw-r--r-- | libnm/nm-device-wifi.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/libnm/nm-device-wifi.c b/libnm/nm-device-wifi.c index 790ddf4ca6..f0b53f54f1 100644 --- a/libnm/nm-device-wifi.c +++ b/libnm/nm-device-wifi.c @@ -520,10 +520,7 @@ clean_up_aps (NMDeviceWifi *self, gboolean in_dispose) priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - if (priv->active_ap) { - g_object_unref (priv->active_ap); - priv->active_ap = NULL; - } + g_clear_object (&priv->active_ap); aps = priv->aps; @@ -722,10 +719,7 @@ state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data) case NM_DEVICE_STATE_DISCONNECTED: case NM_DEVICE_STATE_FAILED: /* Just clear active AP; don't clear the AP list unless wireless is disabled completely */ - if (priv->active_ap) { - g_object_unref (priv->active_ap); - priv->active_ap = NULL; - } + g_clear_object (&priv->active_ap); _nm_object_queue_notify (NM_OBJECT (device), NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT); priv->rate = 0; _nm_object_queue_notify (NM_OBJECT (device), NM_DEVICE_WIFI_BITRATE); @@ -764,8 +758,7 @@ access_point_removed (NMDeviceWifi *self, NMAccessPoint *ap) NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); if (ap == priv->active_ap) { - g_object_unref (priv->active_ap); - priv->active_ap = NULL; + g_clear_object (&priv->active_ap); _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT); priv->rate = 0; |