[PATCH 2/2] device: showcase using priv pointer for nm_device_dbus_export()



---
And using like this...

 src/devices/nm-device.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 8949279..f624b90 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -487,16 +487,13 @@ void
 nm_device_dbus_export (NMDevice *self)
 {
        static guint32 devcount = 0;
-       NMDevicePrivate *priv;
 
        g_return_if_fail (NM_IS_DEVICE (self));
+       g_return_if_fail (self->priv->path == NULL);
 
-       priv = NM_DEVICE_GET_PRIVATE (self);
-       g_return_if_fail (priv->path == NULL);
-
-       priv->path = g_strdup_printf ("/org/freedesktop/NetworkManager/Devices/%d", devcount++);
-       _LOGD (LOGD_DEVICE, "exported as %s", priv->path);
-       nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self);
+       self->priv->path = g_strdup_printf ("/org/freedesktop/NetworkManager/Devices/%d", devcount++);
+       _LOGD (LOGD_DEVICE, "exported as %s", self->priv->path);
+       nm_dbus_manager_register_object (nm_dbus_manager_get (), self->priv->path, self);
 }
 
 const char *
-- 
2.1.0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]