mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 07:10:07 +01:00
libnm: minor refactoring by using g_clear_object() and nm_str_not_empty()
This commit is contained in:
parent
c4198d45e3
commit
21d7aa9204
2 changed files with 4 additions and 18 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -2084,16 +2084,9 @@ done:
|
|||
const char *
|
||||
nm_device_get_physical_port_id (NMDevice *device)
|
||||
{
|
||||
NMDevicePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
|
||||
|
||||
priv = NM_DEVICE_GET_PRIVATE (device);
|
||||
|
||||
if (priv->physical_port_id && *priv->physical_port_id)
|
||||
return priv->physical_port_id;
|
||||
else
|
||||
return NULL;
|
||||
return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->physical_port_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue