[gegl/pippin/property-keys: 9/16] property-keys: unref instead of destroying hashtable



commit 228dbd2a5b00a0f19847cdfd79d47cd7efb1d479
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed May 14 21:07:42 2014 +0200

    property-keys: unref instead of destroying hashtable

 gegl/operation/gegl-operation-property-keys.c |   20 +++++-----
 gegl/operation/gegl-operation-property-keys.h |   10 ++--
 gegl/property-types/gegl-paramspecs.c         |   52 ++++++++++++------------
 3 files changed, 41 insertions(+), 41 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-property-keys.c b/gegl/operation/gegl-operation-property-keys.c
index 938e86c..08c80b1 100644
--- a/gegl/operation/gegl-operation-property-keys.c
+++ b/gegl/operation/gegl-operation-property-keys.c
@@ -27,42 +27,42 @@
 #include "gegl-operation-property-keys.h"
 
 static GHashTable *
-gegl_paramspec_get_property_key_ht (GParamSpec  *pspec,
+gegl_param_spec_get_property_key_ht (GParamSpec  *pspec,
                                     gboolean     create)
 {
   GHashTable *ret = NULL;
   if (pspec)
     {
-      GQuark quark = g_quark_from_static_string ("meta");
+      GQuark quark = g_quark_from_static_string ("gegl-property-keys");
       ret = g_param_spec_get_qdata (pspec, quark);
       if (!ret && create)
       {
         ret = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
         g_param_spec_set_qdata_full (pspec, quark, ret, 
-                                     (GDestroyNotify)g_hash_table_destroy);
+                                     (GDestroyNotify)g_hash_table_unref);
       }
     }
   return ret;
 }
 
 const gchar *
-gegl_paramspec_get_property_key (GParamSpec  *pspec,
+gegl_param_spec_get_property_key (GParamSpec  *pspec,
                                  const gchar *key_name)
 {
   GHashTable *ht;
-  ht = gegl_paramspec_get_property_key_ht (pspec, FALSE);
+  ht = gegl_param_spec_get_property_key_ht (pspec, FALSE);
   if (ht)
     return g_hash_table_lookup (ht, key_name);
   return NULL;
 }
 
 const gchar *
-gegl_paramspec_set_property_key (GParamSpec  *pspec,
+gegl_param_spec_set_property_key (GParamSpec  *pspec,
                                  const gchar *key_name,
                                  const gchar *value)
 {
   GHashTable *ht;
-  ht = gegl_paramspec_get_property_key_ht (pspec, TRUE);
+  ht = gegl_param_spec_get_property_key_ht (pspec, TRUE);
   if (ht)
     g_hash_table_insert (ht, g_strdup (key_name), g_strdup (value));
   return NULL;
@@ -77,7 +77,7 @@ gegl_operation_class_get_property_key_ht (GeglOperationClass *operation_class,
   pspec = g_object_class_find_property (G_OBJECT_CLASS (operation_class),
                                         property_name);
   if (pspec)
-    return gegl_paramspec_get_property_key_ht (pspec, create);
+    return gegl_param_spec_get_property_key_ht (pspec, create);
   return NULL;
 }
 
@@ -135,7 +135,7 @@ gegl_operation_class_set_property_key (GeglOperationClass *operation_class,
   pspec = g_object_class_find_property (G_OBJECT_CLASS (operation_class),
                                         property_name);
   if (pspec)
-    gegl_paramspec_set_property_key (pspec, key_name, value);
+    gegl_param_spec_set_property_key (pspec, key_name, value);
 }
 
 
@@ -148,7 +148,7 @@ gegl_operation_class_get_property_key (GeglOperationClass *operation_class,
   pspec = g_object_class_find_property (G_OBJECT_CLASS (operation_class),
                                         property_name);
   if (pspec)
-    return gegl_paramspec_get_property_key (pspec, key_name);
+    return gegl_param_spec_get_property_key (pspec, key_name);
   return NULL;
 }
 
diff --git a/gegl/operation/gegl-operation-property-keys.h b/gegl/operation/gegl-operation-property-keys.h
index 0ffa044..dc8432e 100644
--- a/gegl/operation/gegl-operation-property-keys.h
+++ b/gegl/operation/gegl-operation-property-keys.h
@@ -21,12 +21,12 @@
 
 #include <glib-object.h>
 
-const gchar *gegl_paramspec_get_property_key (GParamSpec  *pspec,
-                                              const gchar *key_name);
+const gchar *gegl_param_spec_get_property_key (GParamSpec  *pspec,
+                                               const gchar *key_name);
 
-const gchar *gegl_paramspec_set_property_key (GParamSpec  *pspec,
-                                              const gchar *key_name,
-                                              const gchar *value);
+const gchar *gegl_param_spec_set_property_key (GParamSpec  *pspec,
+                                               const gchar *key_name,
+                                               const gchar *value);
 
 void       gegl_operation_class_set_property_key
                                             (GeglOperationClass *klass,
diff --git a/gegl/property-types/gegl-paramspecs.c b/gegl/property-types/gegl-paramspecs.c
index 09eef1d..6fb7cb8 100644
--- a/gegl/property-types/gegl-paramspecs.c
+++ b/gegl/property-types/gegl-paramspecs.c
@@ -811,8 +811,8 @@ gegl_param_spec_double_from_vararg (const char *name, ...)
                                GEGL_PARAM_PAD_INPUT));
 #endif
 
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -882,8 +882,8 @@ gegl_param_spec_int_from_vararg (const char *name, ...)
                                GEGL_PARAM_PAD_INPUT));
 #endif
 
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -926,8 +926,8 @@ gegl_param_spec_boolean_from_vararg (const char *name, ...)
                             G_PARAM_READWRITE |
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -969,8 +969,8 @@ gegl_param_spec_string_from_vararg (const char *name, ...)
                             G_PARAM_READWRITE |
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -1013,8 +1013,8 @@ gegl_param_spec_file_path_from_vararg (const char *name, ...)
                             G_PARAM_READWRITE |
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -1058,8 +1058,8 @@ gegl_param_spec_enum_from_vararg (const char *name, GType enum_type, ...)
                              G_PARAM_READWRITE |
                              G_PARAM_CONSTRUCT |
                              GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -1097,8 +1097,8 @@ gegl_param_spec_pointer_from_vararg (const char *name, ...)
                             G_PARAM_READWRITE |
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -1137,8 +1137,8 @@ gegl_param_spec_object_from_vararg (const char *name, ...)
                             G_PARAM_READWRITE |
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -1180,8 +1180,8 @@ gegl_param_spec_curve_from_vararg (const char *name, ...)
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
   g_object_unref (curve);
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -1219,8 +1219,8 @@ gegl_param_spec_path_from_vararg (const char *name, ...)
                             G_PARAM_READWRITE |
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -1258,8 +1258,8 @@ gegl_param_spec_format_from_vararg (const char *name, ...)
                             G_PARAM_READWRITE |
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -1304,8 +1304,8 @@ gegl_param_spec_color_from_vararg (const char *name, ...)
                             G_PARAM_READWRITE |
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }
 
@@ -1343,7 +1343,7 @@ gegl_param_spec_seed_from_vararg (const char *name, ...)
                             G_PARAM_READWRITE |
                             G_PARAM_CONSTRUCT |
                             GEGL_PARAM_PAD_INPUT));
-  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("meta"),
-                               ht, (GDestroyNotify)g_hash_table_destroy);
+  g_param_spec_set_qdata_full (pspec, g_quark_from_static_string ("gegl-property-keys"),
+                               ht, (GDestroyNotify)g_hash_table_unref);
   return pspec;
 }


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