From cd1df0cf8df0b0d6962443ad4ffffb5f2929ddf2 Mon Sep 17 00:00:00 2001 From: Frederic Peters Date: Tue, 29 Apr 2008 12:10:19 +0000 Subject: [project @ fpeters@0d.be-20080410163456-r6a9flm66nhyap6m] Merge from bdauvergne: factorize the backward compatibility code for GHashTable, fixed placement of declarations. Original author: Frederic Peters Date: 2008-04-10 18:34:56.595000+02:00 --- bindings/lang_python_wrapper_top.c | 54 +------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) (limited to 'bindings/lang_python_wrapper_top.c') diff --git a/bindings/lang_python_wrapper_top.c b/bindings/lang_python_wrapper_top.c index 4ef300a5..dcfa3d52 100644 --- a/bindings/lang_python_wrapper_top.c +++ b/bindings/lang_python_wrapper_top.c @@ -2,6 +2,7 @@ #include #include #include +#include "../ghashtable.h" GQuark lasso_wrapper_key; @@ -33,59 +34,6 @@ noneRef() { Py_INCREF(Py_None); return Py_None; } -#if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 12) -void -g_hash_table_remove_all (GHashTable *hash_table) -{ - g_return_if_fail (hash_table != NULL); - - g_hash_table_remove_all_nodes (hash_table, TRUE); - g_hash_table_maybe_resize (hash_table); -} -#endif -#if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 14) - /* copy of private struct and g_hash_table_get_keys from GLib internals - * (as this function is useful but new in 2.14) */ - -typedef struct _GHashNode GHashNode; - -struct _GHashNode -{ - gpointer key; - gpointer value; - GHashNode *next; - guint key_hash; -}; - -struct _GHashTable -{ - gint size; - gint nnodes; - GHashNode **nodes; - GHashFunc hash_func; - GEqualFunc key_equal_func; - volatile gint ref_count; - GDestroyNotify key_destroy_func; - GDestroyNotify value_destroy_func; -}; - -static GList * -g_hash_table_get_keys (GHashTable *hash_table) -{ - GHashNode *node; - gint i; - GList *retval; - - g_return_val_if_fail (hash_table != NULL, NULL); - - retval = NULL; - for (i = 0; i < hash_table->size; i++) - for (node = hash_table->nodes[i]; node; node = node->next) - retval = g_list_prepend (retval, node->key); - - return retval; -} -#endif static PyObject* get_dict_from_hashtable_of_objects(GHashTable *value) -- cgit