[gupnp/wip/phako/new-api] wip: Move value helper to gvalue util



commit 33e84dc06c7d32662d389cf3744ee933d1de63ad
Author: Jens Georg <mail jensge org>
Date:   Sun Jan 13 18:08:54 2019 +0100

    wip: Move value helper to gvalue util

 libgupnp/gupnp-service-proxy-action.c |  4 ++--
 libgupnp/gupnp-service-proxy.c        | 19 ++++---------------
 libgupnp/gvalue-util.c                | 11 +++++++++++
 libgupnp/gvalue-util.h                |  3 +++
 4 files changed, 20 insertions(+), 17 deletions(-)
---
diff --git a/libgupnp/gupnp-service-proxy-action.c b/libgupnp/gupnp-service-proxy-action.c
index 05fa596..493a1e5 100644
--- a/libgupnp/gupnp-service-proxy-action.c
+++ b/libgupnp/gupnp-service-proxy-action.c
@@ -281,7 +281,7 @@ gupnp_service_proxy_action_new (const char *action,
                                                            in_names,
                                                            in_values);;
         g_list_free_full (in_names, g_free);
-        g_list_free_full (in_values, _value_free);
+        g_list_free_full (in_values, gvalue_free);
 
         return result;
 }
@@ -486,7 +486,7 @@ gupnp_service_proxy_action_get_result_valist (GUPnPServiceProxyAction *action,
         out_hash = g_hash_table_new_full (g_str_hash,
                                           g_str_equal,
                                           g_free,
-                                          _value_free);
+                                          gvalue_free);
         G_VA_COPY (var_args_copy, var_args);
         VAR_ARGS_TO_OUT_HASH_TABLE (var_args, out_hash);
         local_error = NULL;
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index 6db9a50..a78d7ca 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -411,17 +411,6 @@ gupnp_service_proxy_send_action (GUPnPServiceProxy *proxy,
         return ret;
 }
 
-/* GDestroyNotify for GHashTable holding GValues.
- */
-void
-_value_free (gpointer data)
-{
-  GValue *value = (GValue *) data;
-
-  g_value_unset (value);
-  g_free (value);
-}
-
 /**
  * gupnp_service_proxy_send_action_valist:
  * @proxy: A #GUPnPServiceProxy
@@ -457,7 +446,7 @@ gupnp_service_proxy_send_action_valist (GUPnPServiceProxy *proxy,
         out_hash = g_hash_table_new_full (g_str_hash,
                                           g_str_equal,
                                           g_free,
-                                          _value_free);
+                                          gvalue_free);
         VAR_ARGS_TO_OUT_HASH_TABLE (var_args, out_hash);
 
         handle = gupnp_service_proxy_action_new_from_list (action_name, in_names, in_values);
@@ -480,7 +469,7 @@ out:
         gupnp_service_proxy_action_unref (handle);
         va_end (var_args_copy);
         g_list_free_full (in_names, g_free);
-        g_list_free_full (in_values, _value_free);
+        g_list_free_full (in_values, gvalue_free);
         g_hash_table_unref (out_hash);
 
         return result;
@@ -596,7 +585,7 @@ gupnp_service_proxy_begin_action (GUPnPServiceProxy              *proxy,
 
         ret = gupnp_service_proxy_action_new_from_list (action, in_names, in_values);
         g_list_free_full (in_names, g_free);
-        g_list_free_full (in_values, _value_free);
+        g_list_free_full (in_values, gvalue_free);
 
         ret->callback = callback;
         ret->user_data = user_data;
@@ -897,7 +886,7 @@ gupnp_service_proxy_begin_action_valist
 
         ret = gupnp_service_proxy_action_new_from_list (action, in_names, in_values);
         g_list_free_full (in_names, g_free);
-        g_list_free_full (in_values, _value_free);
+        g_list_free_full (in_values, gvalue_free);
 
         ret->callback = callback;
         ret->user_data = user_data;
diff --git a/libgupnp/gvalue-util.c b/libgupnp/gvalue-util.c
index c5a2912..1682806 100644
--- a/libgupnp/gvalue-util.c
+++ b/libgupnp/gvalue-util.c
@@ -264,3 +264,14 @@ gvalue_util_value_append_to_xml_string (const GValue *value,
                 }
         }
 }
+
+/* GDestroyNotify for GHashTable holding GValues.
+ */
+void
+gvalue_free (gpointer data)
+{
+  GValue *value = (GValue *) data;
+
+  g_value_unset (value);
+  g_free (value);
+}
diff --git a/libgupnp/gvalue-util.h b/libgupnp/gvalue-util.h
index 250bb35..eb5e707 100644
--- a/libgupnp/gvalue-util.h
+++ b/libgupnp/gvalue-util.h
@@ -37,4 +37,7 @@ G_GNUC_INTERNAL gboolean
 gvalue_util_value_append_to_xml_string (const GValue *value,
                                         GString      *str);
 
+G_GNUC_INTERNAL void
+gvalue_free                            (gpointer data);
+
 #endif /* GUPNP_GVALUE_UTIL_H */


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