diff options
author | Thomas Haller <thaller@redhat.com> | 2019-01-28 12:15:39 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-02-01 17:02:57 +0100 |
commit | 43aa288fd88e0b6c71a74258332baee29e946ed5 (patch) | |
tree | 1f2a3703bd5a5e79d85f374492591fe66e0823d0 | |
parent | 6e45cd900c6e12e0bf10ec229cc9b190c074fabe (diff) | |
download | NetworkManager-43aa288fd88e0b6c71a74258332baee29e946ed5.tar.gz |
core/p2p-wifi: various minor cleanups
-rw-r--r-- | src/devices/wifi/nm-device-p2p-wifi.c | 3 | ||||
-rw-r--r-- | src/devices/wifi/nm-device-p2p-wifi.h | 1 | ||||
-rw-r--r-- | src/devices/wifi/nm-device-wifi.c | 16 | ||||
-rw-r--r-- | src/devices/wifi/nm-wifi-p2p-peer.c | 8 |
4 files changed, 13 insertions, 15 deletions
diff --git a/src/devices/wifi/nm-device-p2p-wifi.c b/src/devices/wifi/nm-device-p2p-wifi.c index d7d6001dde..6400bedcfa 100644 --- a/src/devices/wifi/nm-device-p2p-wifi.c +++ b/src/devices/wifi/nm-device-p2p-wifi.c @@ -309,7 +309,7 @@ complete_connection (NMDevice *device, } setting_peer = nm_wifi_p2p_peer_get_address (peer); - g_assert (setting_peer); + g_return_val_if_fail (setting_peer, FALSE); } /* Add a P2P wifi setting if one doesn't exist yet */ @@ -1248,7 +1248,6 @@ constructed (GObject *object) G_OBJECT_CLASS (nm_device_p2p_wifi_parent_class)->constructed (object); - /* Connect to the supplicant manager */ priv->sup_mgr = g_object_ref (nm_supplicant_manager_get ()); nm_device_add_pending_action (NM_DEVICE (self), NM_PENDING_ACTION_WAITING_FOR_SUPPLICANT, FALSE); diff --git a/src/devices/wifi/nm-device-p2p-wifi.h b/src/devices/wifi/nm-device-p2p-wifi.h index 128914e055..b57a3f835b 100644 --- a/src/devices/wifi/nm-device-p2p-wifi.h +++ b/src/devices/wifi/nm-device-p2p-wifi.h @@ -38,7 +38,6 @@ #define NM_DEVICE_P2P_WIFI_MGMT_IFACE "mgmt-iface" - typedef struct _NMDeviceP2PWifi NMDeviceP2PWifi; typedef struct _NMDeviceP2PWifiClass NMDeviceP2PWifiClass; diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 4ba14ac336..cd1b5e6927 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -22,13 +22,13 @@ #include "nm-default.h" #include "nm-device-wifi.h" -#include "nm-device-p2p-wifi.h" #include <netinet/in.h> #include <string.h> #include <unistd.h> #include <errno.h> +#include "nm-device-p2p-wifi.h" #include "nm-wifi-ap.h" #include "nm-common-macros.h" #include "devices/nm-device.h" @@ -2047,8 +2047,8 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, && new_state <= NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) priv->ssid_found = TRUE; - if (old_state < NM_SUPPLICANT_INTERFACE_STATE_READY && - new_state >= NM_SUPPLICANT_INTERFACE_STATE_READY) + if ( old_state < NM_SUPPLICANT_INTERFACE_STATE_READY + && new_state >= NM_SUPPLICANT_INTERFACE_STATE_READY) recheck_p2p_availability (self); switch (new_state) { @@ -2247,7 +2247,8 @@ recheck_p2p_availability (NMDeviceWifi *self) NULL); if (p2p_available && !priv->p2p_device) { - g_autofree char *iface_name = NULL; + gs_free char *iface_name = NULL; + /* Create a P2P device. "p2p-dev-" is the same prefix as chosen by * wpa_supplicant internally. */ @@ -2265,8 +2266,7 @@ recheck_p2p_availability (NMDeviceWifi *self) } else if (!p2p_available && priv->p2p_device) { /* Destroy the P2P device. */ g_object_remove_weak_pointer (G_OBJECT (priv->p2p_device), (gpointer*) &priv->p2p_device); - nm_device_p2p_wifi_remove (priv->p2p_device); - priv->p2p_device = NULL; + nm_device_p2p_wifi_remove (g_steal_pointer (&priv->p2p_device)); } } @@ -3509,7 +3509,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass) g_signal_new (NM_DEVICE_WIFI_P2P_DEVICE_CREATED, G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, NULL, + 0, NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, NM_TYPE_DEVICE); } diff --git a/src/devices/wifi/nm-wifi-p2p-peer.c b/src/devices/wifi/nm-wifi-p2p-peer.c index 417365907c..b34ba7af83 100644 --- a/src/devices/wifi/nm-wifi-p2p-peer.c +++ b/src/devices/wifi/nm-wifi-p2p-peer.c @@ -656,10 +656,10 @@ static const NMDBusInterfaceInfoExtended interface_info_p2p_peer = { }; static void -nm_wifi_p2p_peer_class_init (NMWifiP2PPeerClass *p2p_peer_class) +nm_wifi_p2p_peer_class_init (NMWifiP2PPeerClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (p2p_peer_class); - NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (p2p_peer_class); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); g_type_class_add_private (object_class, sizeof (NMWifiP2PPeerPrivate)); @@ -667,7 +667,7 @@ nm_wifi_p2p_peer_class_init (NMWifiP2PPeerClass *p2p_peer_class) dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_p2p_peer); object_class->get_property = get_property; - object_class->finalize = finalize; + object_class->finalize = finalize; obj_properties[PROP_FLAGS] = g_param_spec_uint (NM_WIFI_P2P_PEER_FLAGS, "", "", |