diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-12-03 09:40:59 +0100 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-12-03 09:40:59 +0100 |
| commit | d97adfc27ac1558d3cb729fe054641d97f6d3fba (patch) | |
| tree | e569786585f9c2cc200e4fb71c73406c504105cc /bindings | |
| parent | 4161904317e5df32e402f365950456352c0a2c57 (diff) | |
| parent | 6c598662a058049b54ca2f3f4cf8104a65734466 (diff) | |
Merge branch 'hotfixes-2.3.5'
Diffstat (limited to 'bindings')
| -rw-r--r-- | bindings/ghashtable.h | 10 | ||||
| -rw-r--r-- | bindings/perl/Makefile.am | 2 | ||||
| -rw-r--r-- | bindings/perl/ghashtable_handling.c | 31 |
3 files changed, 26 insertions, 17 deletions
diff --git a/bindings/ghashtable.h b/bindings/ghashtable.h index 4e4a7d2e..ef9133f1 100644 --- a/bindings/ghashtable.h +++ b/bindings/ghashtable.h @@ -2,6 +2,8 @@ #define G_HASHTABLE_H 1 #if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 14) +#include "../lasso/utils.h" + typedef struct _GHashNode GHashNode; struct _GHashNode @@ -32,7 +34,7 @@ static gboolean return_true(G_GNUC_UNUSED gpointer a, G_GNUC_UNUSED gpointer b, return TRUE; } -void +static void g_hash_table_remove_all (GHashTable *hash_table) { lasso_return_if_fail(hash_table != NULL); @@ -51,7 +53,7 @@ g_hash_table_get_keys (GHashTable *hash_table) gint i; GList *retval; - lasso_return_if_fail(hash_table != NULL, NULL); + lasso_return_val_if_fail(hash_table != NULL, NULL); retval = NULL; for (i = 0; i < hash_table->size; i++) @@ -61,14 +63,14 @@ g_hash_table_get_keys (GHashTable *hash_table) return retval; } -GList * +static GList * g_hash_table_get_values (GHashTable *hash_table) { GHashNode *node; gint i; GList *retval; - lasso_return_if_fail(hash_table != NULL, NULL); + lasso_return_val_if_fail(hash_table != NULL, NULL); retval = NULL; for (i = 0; i < hash_table->size; i++) diff --git a/bindings/perl/Makefile.am b/bindings/perl/Makefile.am index 3ee1d18a..fcbdbeea 100644 --- a/bindings/perl/Makefile.am +++ b/bindings/perl/Makefile.am @@ -58,7 +58,7 @@ distclean-local: clean-local: -@if [ -f Makefile.perl ]; then make -f Makefile.perl clean; fi; rm -f Makefile.perl -install-exec-local: +install-exec-local: Makefile.perl make -f Makefile.perl install DESTDIR=$(DESTDIR) PREFIX=$(prefix) uninstall-local: diff --git a/bindings/perl/ghashtable_handling.c b/bindings/perl/ghashtable_handling.c index b49ed9f5..541041d8 100644 --- a/bindings/perl/ghashtable_handling.c +++ b/bindings/perl/ghashtable_handling.c @@ -78,6 +78,15 @@ set_hash_of_objects(GHashTable **hash, HV *hv) } } +static void +__ht_foreach_get_hos(gpointer key, gpointer value, gpointer user_data) +{ + HV *hv = user_data; + + (void)hv_store(hv, key, strlen(key), newSVpv(value, 0), 0); +} + + /** * get_hash_of_strings: * @hash: a #GHashTable of strings @@ -85,18 +94,21 @@ set_hash_of_objects(GHashTable **hash, HV *hv) HV* get_hash_of_strings(GHashTable *hash) { - GHashTableIter iter; - gpointer key, value; HV *hv; hv = newHV(); - g_hash_table_iter_init(&iter, hash); - while (g_hash_table_iter_next(&iter, &key, &value)) { - (void)hv_store(hv, key, strlen(key), newSVpv(value, 0), 0); - } + g_hash_table_foreach(hash, __ht_foreach_get_hos, hv); return hv; } +static void +__ht_foreach_get_hoo(gpointer key, gpointer value, gpointer user_data) +{ + HV *hv = user_data; + + (void)hv_store(hv, key, strlen(key), gperl_new_object(value, FALSE), 0); +} + /** * get_hash_of_objects: * @hash: a #GHashTable of objects @@ -104,14 +116,9 @@ get_hash_of_strings(GHashTable *hash) HV* get_hash_of_objects(GHashTable *hash) { - GHashTableIter iter; - gpointer key, value; HV *hv; hv = newHV(); - g_hash_table_iter_init(&iter, hash); - while (g_hash_table_iter_next(&iter, &key, &value)) { - (void)hv_store(hv, key, strlen(key), gperl_new_object(value, FALSE), 0); - } + g_hash_table_foreach(hash, __ht_foreach_get_hos, hv); return hv; } |
