[libdmapsharing] Fix pedansee warnings in dmap-mdns-browser-avahi.c and dmap-mdns-publisher-avahi.c



commit 534cba21cc72cfe5bc3665d558dd1cd93bc38127
Author: W. Michael Petullo <mike flyn org>
Date:   Tue Apr 24 22:03:57 2018 -0400

    Fix pedansee warnings in dmap-mdns-browser-avahi.c and dmap-mdns-publisher-avahi.c
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/dmap-mdns-browser-avahi.c   | 140 +++++++++++++++--------------
 libdmapsharing/dmap-mdns-publisher-avahi.c | 132 ++++++++++++++-------------
 2 files changed, 144 insertions(+), 128 deletions(-)
---
diff --git a/libdmapsharing/dmap-mdns-browser-avahi.c b/libdmapsharing/dmap-mdns-browser-avahi.c
index 7abedde..849e012 100644
--- a/libdmapsharing/dmap-mdns-browser-avahi.c
+++ b/libdmapsharing/dmap-mdns-browser-avahi.c
@@ -65,10 +65,10 @@ enum
 
 static void dmap_mdns_browser_class_init (DmapMdnsBrowserClass * klass);
 static void dmap_mdns_browser_init (DmapMdnsBrowser * browser);
-static void dmap_mdns_browser_dispose (GObject * object);
-static void dmap_mdns_browser_finalize (GObject * object);
-static void avahi_client_init (DmapMdnsBrowser * browser);
-static void resolve_cb (AvahiServiceResolver * service_resolver,
+static void _dispose (GObject * object);
+static void _finalize (GObject * object);
+static void _client_init (DmapMdnsBrowser * browser);
+static void _resolve_cb (AvahiServiceResolver * service_resolver,
                        AvahiIfIndex interface,
                        AvahiProtocol protocol,
                        AvahiResolverEvent event,
@@ -82,28 +82,28 @@ static void resolve_cb (AvahiServiceResolver * service_resolver,
                        AvahiLookupResultFlags flags,
 #endif
                        DmapMdnsBrowser * browser);
-static gboolean dmap_mdns_browser_resolve (DmapMdnsBrowser * browser,
-                                          const gchar * name,
-                                          const gchar * domain);
-static void browser_add_service (DmapMdnsBrowser * browser,
-                                const gchar * service_name,
-                                const gchar * domain);
-static void browser_remove_service (DmapMdnsBrowser * browser,
-                                   const gchar * service_name);
-static void browse_cb (AvahiServiceBrowser * service_browser,
-                      AvahiIfIndex interface,
-                      AvahiProtocol protocol,
-                      AvahiBrowserEvent event,
-                      const gchar * name,
-                      const gchar * type, const gchar * domain,
+static gboolean _resolve (DmapMdnsBrowser * browser,
+                          const gchar * name,
+                          const gchar * domain);
+static void _add_service (DmapMdnsBrowser * browser,
+                          const gchar * service_name,
+                          const gchar * domain);
+static void _remove_service (DmapMdnsBrowser * browser,
+                             const gchar * service_name);
+static void _browse_cb (AvahiServiceBrowser * service_browser,
+                        AvahiIfIndex interface,
+                        AvahiProtocol protocol,
+                        AvahiBrowserEvent event,
+                        const gchar * name,
+                        const gchar * type, const gchar * domain,
 #ifdef HAVE_AVAHI_0_6
-                      AvahiLookupResultFlags flags,
+                        AvahiLookupResultFlags flags,
 #endif
-                      DmapMdnsBrowser * browser);
+                        DmapMdnsBrowser * browser);
 
 #define DMAP_MDNS_BROWSER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DMAP_TYPE_MDNS_BROWSER, 
DmapMdnsBrowserPrivate))
 
-static guint dmap_mdns_browser_signals[LAST_SIGNAL] = { 0, };
+static guint _signals[LAST_SIGNAL] = { 0, };
 
 G_DEFINE_TYPE (DmapMdnsBrowser, dmap_mdns_browser, G_TYPE_OBJECT);
 
@@ -126,12 +126,12 @@ dmap_mdns_browser_class_init (DmapMdnsBrowserClass * klass)
 
        dmap_mdns_browser_parent_class = g_type_class_peek_parent (klass);
 
-       object_class->dispose = dmap_mdns_browser_dispose;
-       object_class->finalize = dmap_mdns_browser_finalize;
+       object_class->dispose  = _dispose;
+       object_class->finalize = _finalize;
 
        g_type_class_add_private (klass, sizeof (DmapMdnsBrowserPrivate));
 
-       dmap_mdns_browser_signals[SERVICE_ADDED] =
+       _signals[SERVICE_ADDED] =
                g_signal_new ("service-added",
                              G_TYPE_FROM_CLASS (object_class),
                              G_SIGNAL_RUN_LAST,
@@ -139,7 +139,7 @@ dmap_mdns_browser_class_init (DmapMdnsBrowserClass * klass)
                                               service_added), NULL, NULL,
                              g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE,
                              1, DMAP_TYPE_MDNS_SERVICE);
-       dmap_mdns_browser_signals[SERVICE_REMOVED] =
+       _signals[SERVICE_REMOVED] =
                g_signal_new ("service-removed",
                              G_TYPE_FROM_CLASS (object_class),
                              G_SIGNAL_RUN_LAST,
@@ -153,11 +153,11 @@ static void
 dmap_mdns_browser_init (DmapMdnsBrowser * browser)
 {
        browser->priv = DMAP_MDNS_BROWSER_GET_PRIVATE (browser);
-       avahi_client_init (browser);
+       _client_init (browser);
 }
 
 static void
-dmap_mdns_browser_dispose (GObject * object)
+_dispose (GObject * object)
 {
        DmapMdnsBrowser *browser = DMAP_MDNS_BROWSER (object);
        GSList *walk;
@@ -191,7 +191,7 @@ dmap_mdns_browser_dispose (GObject * object)
 }
 
 static void
-dmap_mdns_browser_finalize (GObject * object)
+_finalize (GObject * object)
 {
        g_signal_handlers_destroy (object);
        G_OBJECT_CLASS (dmap_mdns_browser_parent_class)->finalize (object);
@@ -239,7 +239,7 @@ dmap_mdns_browser_start (DmapMdnsBrowser * browser, GError ** error)
                                           0,
 #endif
                                           (AvahiServiceBrowserCallback)
-                                          browse_cb, browser);
+                                          _browse_cb, browser);
        if (browser->priv->service_browser == NULL) {
                g_debug ("Error starting mDNS discovery using AvahiServiceBrowser");
                g_set_error (error,
@@ -292,8 +292,8 @@ dmap_mdns_browser_get_service_type (DmapMdnsBrowser * browser)
 }
 
 static void
-client_cb (AvahiClient * client,
-          AvahiClientState state, DmapMdnsBrowser * browser)
+_client_cb (AvahiClient * client,
+            AvahiClientState state, DmapMdnsBrowser * browser)
 {
        /* Called whenever the client or server state changes */
 
@@ -310,7 +310,7 @@ client_cb (AvahiClient * client,
 }
 
 static void
-avahi_client_init (DmapMdnsBrowser * browser)
+_client_init (DmapMdnsBrowser * browser)
 {
        gint error = 0;
 
@@ -324,7 +324,7 @@ avahi_client_init (DmapMdnsBrowser * browser)
 #ifdef HAVE_AVAHI_0_5
        browser->priv->client =
                avahi_client_new (avahi_glib_poll_get (browser->priv->poll),
-                                 (AvahiClientCallback) client_cb, browser,
+                                 (AvahiClientCallback) _client_cb, browser,
                                  &error);
 #endif
 #ifdef HAVE_AVAHI_0_6
@@ -334,27 +334,27 @@ avahi_client_init (DmapMdnsBrowser * browser)
                browser->priv->client =
                        avahi_client_new (avahi_glib_poll_get
                                          (browser->priv->poll), flags,
-                                         (AvahiClientCallback) client_cb,
+                                         (AvahiClientCallback) _client_cb,
                                          browser, &error);
        }
 #endif
 }
 
 static void
-resolve_cb (AvahiServiceResolver * service_resolver,
-           AvahiIfIndex interface,
-           AvahiProtocol protocol,
-           AvahiResolverEvent event,
-           const gchar * service_name,
-           const gchar * type,
-           const gchar * domain,
-           const gchar * host_name,
-           const AvahiAddress * address,
-           uint16_t port, AvahiStringList * text,
+_resolve_cb (AvahiServiceResolver * service_resolver,
+             AvahiIfIndex interface,
+             AvahiProtocol protocol,
+             AvahiResolverEvent event,
+             const gchar * service_name,
+             const gchar * type,
+             const gchar * domain,
+             const gchar * host_name,
+             const AvahiAddress * address,
+             uint16_t port, AvahiStringList * text,
 #ifdef HAVE_AVAHI_0_6
-           AvahiLookupResultFlags flags,
+             AvahiLookupResultFlags flags,
 #endif
-           DmapMdnsBrowser * browser)
+             DmapMdnsBrowser * browser)
 {
        gchar *name = NULL;
        gchar *pair = NULL;     /* FIXME: extract DACP-specific items into sub-class. Ensure in Howl and 
dns-sd code too. */
@@ -401,11 +401,13 @@ resolve_cb (AvahiServiceResolver * service_resolver,
                                                pp = TRUE;
                                        }
                                } else if (strcmp (key, "Machine Name") == 0) {
-                                       if (name == NULL)
+                                       if (name == NULL) {
                                                name = g_strdup (value);
+                                       }
                                } else if (strcmp (key, "DvNm") == 0) {
-                                       if (name != NULL)
+                                       if (name != NULL) {
                                                g_free (name);
+                                       }
                                        /* Remote's name is presented as DvNm in DACP */
                                        name = g_strdup (value);
                                } else if (strcmp (key, "Pair") == 0) {
@@ -441,7 +443,7 @@ resolve_cb (AvahiServiceResolver * service_resolver,
                browser->priv->services =
                        g_slist_append (browser->priv->services, service);
                g_signal_emit (browser,
-                              dmap_mdns_browser_signals[SERVICE_ADDED], 0,
+                              _signals[SERVICE_ADDED], 0,
                               service);
                break;
        default:
@@ -455,9 +457,10 @@ resolve_cb (AvahiServiceResolver * service_resolver,
 }
 
 static gboolean
-dmap_mdns_browser_resolve (DmapMdnsBrowser * browser,
-                          const gchar * name, const gchar * domain)
+_resolve (DmapMdnsBrowser * browser,
+          const gchar * name, const gchar * domain)
 {
+       gboolean ok = FALSE;
        AvahiServiceResolver *service_resolver;
 
        service_resolver = avahi_service_resolver_new (browser->priv->client,
@@ -471,43 +474,46 @@ dmap_mdns_browser_resolve (DmapMdnsBrowser * browser,
 #ifdef HAVE_AVAHI_0_6
                                                       0,
 #endif
-                                                      (AvahiServiceResolverCallback) resolve_cb, browser);
+                                                      (AvahiServiceResolverCallback) _resolve_cb, browser);
        if (service_resolver == NULL) {
                g_debug ("Error starting mDNS resolving using AvahiServiceResolver");
-               return FALSE;
+               goto done;
        }
 
        browser->priv->resolvers =
                g_slist_prepend (browser->priv->resolvers, service_resolver);
 
-       return TRUE;
+       ok = TRUE;
+
+done:
+       return ok;
 }
 
 static void
-browser_add_service (DmapMdnsBrowser * browser,
+_add_service (DmapMdnsBrowser * browser,
                     const gchar * service_name, const gchar * domain)
 {
-       dmap_mdns_browser_resolve (browser, service_name, domain);
+       _resolve (browser, service_name, domain);
 }
 
 static void
-browser_remove_service (DmapMdnsBrowser * browser, const gchar * service_name)
+_remove_service (DmapMdnsBrowser * browser, const gchar * service_name)
 {
        g_signal_emit (browser,
-                      dmap_mdns_browser_signals[SERVICE_REMOVED],
+                      _signals[SERVICE_REMOVED],
                       0, service_name);
 }
 
 static void
-browse_cb (AvahiServiceBrowser * service_browser,
-          AvahiIfIndex interface,
-          AvahiProtocol protocol,
-          AvahiBrowserEvent event,
-          const gchar * name, const gchar * type, const gchar * domain,
+_browse_cb (AvahiServiceBrowser * service_browser,
+            AvahiIfIndex interface,
+            AvahiProtocol protocol,
+            AvahiBrowserEvent event,
+            const gchar * name, const gchar * type, const gchar * domain,
 #ifdef HAVE_AVAHI_0_6
-          AvahiLookupResultFlags flags,
+            AvahiLookupResultFlags flags,
 #endif
-          DmapMdnsBrowser * browser)
+            DmapMdnsBrowser * browser)
 {
        gboolean local;
 
@@ -525,8 +531,8 @@ browse_cb (AvahiServiceBrowser * service_browser,
        }
 
        if (event == AVAHI_BROWSER_NEW) {
-               browser_add_service (browser, name, domain);
+               _add_service (browser, name, domain);
        } else if (event == AVAHI_BROWSER_REMOVE) {
-               browser_remove_service (browser, name);
+               _remove_service (browser, name);
        }
 }
diff --git a/libdmapsharing/dmap-mdns-publisher-avahi.c b/libdmapsharing/dmap-mdns-publisher-avahi.c
index 2dc9e33..6fc3af3 100644
--- a/libdmapsharing/dmap-mdns-publisher-avahi.c
+++ b/libdmapsharing/dmap-mdns-publisher-avahi.c
@@ -40,7 +40,7 @@
 
 static void dmap_mdns_publisher_class_init (DmapMdnsPublisherClass * klass);
 static void dmap_mdns_publisher_init (DmapMdnsPublisher * publisher);
-static void dmap_mdns_publisher_finalize (GObject * object);
+static void _finalize (GObject * object);
 
 #define DMAP_MDNS_PUBLISHER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DMAP_TYPE_MDNS_PUBLISHER, 
DmapMdnsPublisherPrivate))
 
@@ -67,11 +67,11 @@ enum
        LAST_SIGNAL
 };
 
-static guint signals[LAST_SIGNAL] = { 0, };
+static guint _signals[LAST_SIGNAL] = { 0, };
 
 G_DEFINE_TYPE (DmapMdnsPublisher, dmap_mdns_publisher, G_TYPE_OBJECT);
 
-static gpointer publisher_object = NULL;
+static gpointer _publisher_object = NULL;
 
 GQuark
 dmap_mdns_publisher_error_quark (void)
@@ -86,34 +86,35 @@ dmap_mdns_publisher_error_quark (void)
 }
 
 static void
-emit_published (char *name, DmapMdnsPublisher * publisher)
+_emit_published (char *name, DmapMdnsPublisher * publisher)
 {
-       g_signal_emit (publisher, signals[PUBLISHED], 0, name);
+       g_signal_emit (publisher, _signals[PUBLISHED], 0, name);
 }
 
 static void
-entry_group_cb (AvahiEntryGroup * group,
-               AvahiEntryGroupState state, DmapMdnsPublisher * publisher)
+_entry_group_cb (AvahiEntryGroup * group,
+                 AvahiEntryGroupState state, DmapMdnsPublisher * publisher)
 {
        if (state == AVAHI_ENTRY_GROUP_ESTABLISHED) {
                g_slist_foreach (publisher->priv->service,
-                                (GFunc) emit_published, publisher);
+                                (GFunc) _emit_published, publisher);
        } else if (state == AVAHI_ENTRY_GROUP_COLLISION) {
                g_warning ("MDNS name collision");
 
                /* FIXME: how to know which name collided?
-                * g_signal_emit (publisher, signals [NAME_COLLISION], 0, publisher->priv->name);
+                * g_signal_emit (publisher, _signals [NAME_COLLISION], 0, publisher->priv->name);
                 */
-               g_signal_emit (publisher, signals[NAME_COLLISION], 0,
+               g_signal_emit (publisher, _signals[NAME_COLLISION], 0,
                               "unknown");
        }
 }
 
 static gboolean
-create_service (struct DmapMdnsPublisherService *service,
-               DmapMdnsPublisher * publisher, GError ** error)
+_create_service (struct DmapMdnsPublisherService *service,
+                 DmapMdnsPublisher * publisher, GError ** error)
 {
        int ret;
+       gboolean ok = FALSE;
        const char *password_record;
        AvahiStringList *txt_records;
 
@@ -156,15 +157,19 @@ create_service (struct DmapMdnsPublisherService *service,
                             "%s: %s",
                             _("Could not add service"),
                             avahi_strerror (ret));
-               return FALSE;
+               goto done;
        }
 
-       return TRUE;
+       ok = TRUE;
+
+done:
+       return ok;
 }
 
 static gboolean
-create_services (DmapMdnsPublisher * publisher, GError ** error)
+_create_services (DmapMdnsPublisher * publisher, GError ** error)
 {
+       gboolean ok = FALSE;
        static int suffix = 0;
        gchar *name;
        GSList *ptr1, *ptr2;
@@ -175,7 +180,7 @@ create_services (DmapMdnsPublisher * publisher, GError ** error)
                publisher->priv->entry_group =
                        avahi_entry_group_new (publisher->priv->client,
                                               (AvahiEntryGroupCallback)
-                                              entry_group_cb, publisher);
+                                              _entry_group_cb, publisher);
 
                if (publisher->priv->entry_group == NULL) {
                        g_debug ("Could not create AvahiEntryGroup for publishing");
@@ -185,7 +190,7 @@ create_services (DmapMdnsPublisher * publisher, GError ** error)
                                     "%s",
                                     _
                                     ("Could not create AvahiEntryGroup for publishing"));
-                       return FALSE;
+                       goto done;
                }
 
                dmap_mdns_avahi_set_entry_group (publisher->
@@ -210,10 +215,10 @@ create_services (DmapMdnsPublisher * publisher, GError ** error)
                if (strcmp(name, service1->name)) {
                        g_free(service1->name);
                        service1->name = name;
-                       g_signal_emit (publisher, signals[NAME_COLLISION], 0, name);
+                       g_signal_emit (publisher, _signals[NAME_COLLISION], 0, name);
                }
-               if (!create_service (service1, publisher, error)) {
-                       return FALSE;
+               if (!_create_service (service1, publisher, error)) {
+                       goto done;
                }
        }
 
@@ -226,27 +231,31 @@ create_services (DmapMdnsPublisher * publisher, GError ** error)
                             "%s: %s",
                             _("Could not commit service"),
                             avahi_strerror (ret));
-               return FALSE;
+               goto done;
        }
 
-       return TRUE;
+       ok = TRUE;
+
+done:
+       return ok;
 }
 
 static gboolean
-refresh_services (DmapMdnsPublisher * publisher, GError ** error)
+_refresh_services (DmapMdnsPublisher * publisher, GError ** error)
 {
-       return create_services (publisher, error);
+       return _create_services (publisher, error);
 }
 
 static struct DmapMdnsPublisherService *
-find_service_by_port (GSList * list, guint port)
+_find_service_by_port (GSList * list, guint port)
 {
        GSList *ptr;
 
        for (ptr = list; ptr; ptr = g_slist_next (ptr)) {
                if (port ==
-                   ((struct DmapMdnsPublisherService *) ptr->data)->port)
+                   ((struct DmapMdnsPublisherService *) ptr->data)->port) {
                        break;
+               }
        }
 
        return ptr ? ptr->data : NULL;
@@ -261,7 +270,7 @@ dmap_mdns_publisher_rename_at_port (DmapMdnsPublisher * publisher,
 
        g_return_val_if_fail (publisher != NULL, FALSE);
 
-       ptr = find_service_by_port (publisher->priv->service, port);
+       ptr = _find_service_by_port (publisher->priv->service, port);
 
        if (ptr == NULL) {
                g_set_error (error,
@@ -275,7 +284,7 @@ dmap_mdns_publisher_rename_at_port (DmapMdnsPublisher * publisher,
        ptr->name = g_strdup (name);
 
        if (publisher->priv->entry_group) {
-               refresh_services (publisher, error);
+               _refresh_services (publisher, error);
        }
 
        return TRUE;
@@ -311,11 +320,11 @@ dmap_mdns_publisher_publish (DmapMdnsPublisher * publisher,
        publisher->priv->service =
                g_slist_append (publisher->priv->service, service);
 
-       return create_services (publisher, error);
+       return _create_services (publisher, error);
 }
 
 static void
-free_service (struct DmapMdnsPublisherService *service, gpointer user_data)
+_free_service (struct DmapMdnsPublisherService *service, gpointer user_data)
 {
        g_free (service->name);
        g_free (service->type_of_service);
@@ -340,7 +349,7 @@ dmap_mdns_publisher_withdraw (DmapMdnsPublisher * publisher,
 
        if (publisher->priv->entry_group == NULL
            || !(ptr =
-                find_service_by_port (publisher->priv->service, port))) {
+                _find_service_by_port (publisher->priv->service, port))) {
                g_set_error (error, DMAP_MDNS_PUBLISHER_ERROR,
                             DMAP_MDNS_PUBLISHER_ERROR_FAILED, "%s",
                             _("The MDNS service is not published"));
@@ -349,14 +358,14 @@ dmap_mdns_publisher_withdraw (DmapMdnsPublisher * publisher,
 
        publisher->priv->service =
                g_slist_remove (publisher->priv->service, ptr);
-       free_service (ptr, NULL);
+       _free_service (ptr, NULL);
 
        if (publisher->priv->service == NULL) {
                avahi_entry_group_reset (publisher->priv->entry_group);
                avahi_entry_group_free (publisher->priv->entry_group);
                publisher->priv->entry_group = NULL;
        } else {
-               create_services (publisher, error);
+               _create_services (publisher, error);
                if (error != NULL)
                        return FALSE;
        }
@@ -365,9 +374,8 @@ dmap_mdns_publisher_withdraw (DmapMdnsPublisher * publisher,
 }
 
 static void
-dmap_mdns_publisher_set_property (GObject * object,
-                                 guint prop_id,
-                                 const GValue * value, GParamSpec * pspec)
+_set_property (GObject * object, guint prop_id, const GValue * value,
+               GParamSpec * pspec)
 {
        switch (prop_id) {
        default:
@@ -377,9 +385,8 @@ dmap_mdns_publisher_set_property (GObject * object,
 }
 
 static void
-dmap_mdns_publisher_get_property (GObject * object,
-                                 guint prop_id,
-                                 GValue * value, GParamSpec * pspec)
+_get_property (GObject * object, guint prop_id, GValue * value,
+               GParamSpec * pspec)
 {
        switch (prop_id) {
        default:
@@ -389,9 +396,9 @@ dmap_mdns_publisher_get_property (GObject * object,
 }
 
 static GObject *
-dmap_mdns_publisher_constructor (GType type,
-                                guint n_construct_params,
-                                GObjectConstructParam * construct_params)
+_constructor (GType type,
+              guint n_construct_params,
+              GObjectConstructParam * construct_params)
 {
        /* This class is a singleton. */
        static GObject *self = NULL;
@@ -402,10 +409,13 @@ dmap_mdns_publisher_constructor (GType type,
                                                                         n_construct_params,
                                                                         construct_params);
                g_object_add_weak_pointer (self, (gpointer) & self);
-               return self;
+               goto done;
        }
 
-       return g_object_ref (self);
+       self = g_object_ref (self);
+
+done:
+       return self;
 }
 
 static void
@@ -413,12 +423,12 @@ dmap_mdns_publisher_class_init (DmapMdnsPublisherClass * klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       object_class->constructor = dmap_mdns_publisher_constructor;
-       object_class->finalize = dmap_mdns_publisher_finalize;
-       object_class->get_property = dmap_mdns_publisher_get_property;
-       object_class->set_property = dmap_mdns_publisher_set_property;
+       object_class->constructor  = _constructor;
+       object_class->finalize     = _finalize;
+       object_class->get_property = _get_property;
+       object_class->set_property = _set_property;
 
-       signals[PUBLISHED] =
+       _signals[PUBLISHED] =
                g_signal_new ("published",
                              G_TYPE_FROM_CLASS (object_class),
                              G_SIGNAL_RUN_LAST,
@@ -426,7 +436,7 @@ dmap_mdns_publisher_class_init (DmapMdnsPublisherClass * klass)
                                               published), NULL, NULL,
                              g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1,
                              G_TYPE_STRING);
-       signals[NAME_COLLISION] =
+       _signals[NAME_COLLISION] =
                g_signal_new ("name-collision",
                              G_TYPE_FROM_CLASS (object_class),
                              G_SIGNAL_RUN_LAST,
@@ -449,12 +459,12 @@ dmap_mdns_publisher_init (DmapMdnsPublisher * publisher)
 }
 
 static void
-dmap_mdns_publisher_finalize (GObject * object)
+_finalize (GObject * object)
 {
        DmapMdnsPublisher *publisher;
 
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (IS_DMAP_MDNS_PUBLISHER (object));
+       g_assert(NULL != object);
+       g_assert(IS_DMAP_MDNS_PUBLISHER (object));
 
        publisher = DMAP_MDNS_PUBLISHER (object);
 
@@ -475,11 +485,11 @@ dmap_mdns_publisher_finalize (GObject * object)
         * avahi_client_free (publisher->priv->client);
         */
 
-       g_slist_foreach (publisher->priv->service, (GFunc) free_service,
+       g_slist_foreach (publisher->priv->service, (GFunc) _free_service,
                         NULL);
        g_slist_free (publisher->priv->service);
 
-       publisher_object = NULL;
+       _publisher_object = NULL;
 
        G_OBJECT_CLASS (dmap_mdns_publisher_parent_class)->finalize (object);
 }
@@ -487,14 +497,14 @@ dmap_mdns_publisher_finalize (GObject * object)
 DmapMdnsPublisher *
 dmap_mdns_publisher_new (void)
 {
-       if (publisher_object) {
-               g_object_ref (publisher_object);
+       if (_publisher_object) {
+               g_object_ref (_publisher_object);
        } else {
-               publisher_object =
+               _publisher_object =
                        g_object_new (DMAP_TYPE_MDNS_PUBLISHER, NULL);
-               g_object_add_weak_pointer (publisher_object,
-                                          (gpointer *) & publisher_object);
+               g_object_add_weak_pointer (_publisher_object,
+                                          (gpointer *) &_publisher_object);
        }
 
-       return DMAP_MDNS_PUBLISHER (publisher_object);
+       return DMAP_MDNS_PUBLISHER (_publisher_object);
 }


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