[gupnp/wip/phako/cleanup: 8/10] all: Minor simplicifcations and dead code removal
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp/wip/phako/cleanup: 8/10] all: Minor simplicifcations and dead code removal
- Date: Sat, 5 Jun 2021 18:10:00 +0000 (UTC)
commit 88557e4b51006413e0576c83aaa73a7f2e93557b
Author: Jens Georg <mail jensge org>
Date: Sat Jun 5 19:51:23 2021 +0200
all: Minor simplicifcations and dead code removal
libgupnp/gupnp-device-info.c | 22 ++++++----------------
libgupnp/gupnp-service-proxy-action.c | 5 -----
libgupnp/gupnp-service.c | 18 ++++--------------
libgupnp/gupnp-xml-doc.c | 2 +-
4 files changed, 11 insertions(+), 36 deletions(-)
---
diff --git a/libgupnp/gupnp-device-info.c b/libgupnp/gupnp-device-info.c
index 0533b26..016c033 100644
--- a/libgupnp/gupnp-device-info.c
+++ b/libgupnp/gupnp-device-info.c
@@ -168,20 +168,10 @@ gupnp_device_info_dispose (GObject *object)
info = GUPNP_DEVICE_INFO (object);
priv = gupnp_device_info_get_instance_private (info);
- if (priv->factory) {
- g_object_unref (priv->factory);
- priv->factory = NULL;
- }
-
- if (priv->context) {
- g_object_unref (priv->context);
- priv->context = NULL;
- }
-
- if (priv->doc) {
- g_object_unref (priv->doc);
- priv->doc = NULL;
- }
+ g_clear_object (&priv->factory);
+ g_clear_object (&priv->factory);
+ g_clear_object (&priv->context);
+ g_clear_object (&priv->doc);
G_OBJECT_CLASS (gupnp_device_info_parent_class)->dispose (object);
}
@@ -722,7 +712,7 @@ typedef struct {
} Icon;
static Icon *
-icon_parse (G_GNUC_UNUSED GUPnPDeviceInfo *info, xmlNode *element)
+icon_parse (xmlNode *element)
{
Icon *icon;
@@ -819,7 +809,7 @@ gupnp_device_info_get_icon_url (GUPnPDeviceInfo *info,
if (!strcmp ("icon", (char *) element->name)) {
gboolean mime_type_ok;
- icon = icon_parse (info, element);
+ icon = icon_parse (element);
if (requested_mime_type) {
if (icon->mime_type)
diff --git a/libgupnp/gupnp-service-proxy-action.c b/libgupnp/gupnp-service-proxy-action.c
index 1d19411..456a005 100644
--- a/libgupnp/gupnp-service-proxy-action.c
+++ b/libgupnp/gupnp-service-proxy-action.c
@@ -191,11 +191,6 @@ check_action_response (G_GNUC_UNUSED GUPnPServiceProxy *proxy,
}
-/* GDestroyNotify for GHashTable holding GValues.
- */
-G_GNUC_INTERNAL void
-_value_free (gpointer data);
-
GUPnPServiceProxyAction *
gupnp_service_proxy_action_new_internal (const char *action) {
GUPnPServiceProxyAction *ret;
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index faf8004..bacf977 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -1736,7 +1736,6 @@ gupnp_service_finalize (GObject *object)
GUPnPService *service;
GUPnPServicePrivate *priv;
GObjectClass *object_class;
- NotifyData *data;
service = GUPNP_SERVICE (object);
priv = gupnp_service_get_instance_private (service);
@@ -1748,20 +1747,11 @@ gupnp_service_finalize (GObject *object)
g_list_free_full (priv->state_variables, g_free);
/* Free notify queue */
- while ((data = g_queue_pop_head (priv->notify_queue)))
- notify_data_free (data);
-
- g_queue_free (priv->notify_queue);
+ g_queue_free_full (priv->notify_queue,
+ (GDestroyNotify) notify_data_free);
- if (priv->session) {
- g_object_unref (priv->session);
- priv->session = NULL;
- }
-
- if (priv->introspection) {
- g_object_unref (priv->introspection);
- priv->introspection = NULL;
- }
+ g_clear_object (&priv->session);
+ g_clear_object (&priv->introspection);
/* Call super */
object_class = G_OBJECT_CLASS (gupnp_service_parent_class);
diff --git a/libgupnp/gupnp-xml-doc.c b/libgupnp/gupnp-xml-doc.c
index 353632d..0155ea4 100644
--- a/libgupnp/gupnp-xml-doc.c
+++ b/libgupnp/gupnp-xml-doc.c
@@ -65,7 +65,7 @@ gupnp_xml_doc_finalize (GObject *object)
doc = GUPNP_XML_DOC (object);
- xmlFreeDoc (doc->doc);
+ g_clear_pointer (&doc->doc, xmlFreeDoc);
G_OBJECT_CLASS (gupnp_xml_doc_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]