summaryrefslogtreecommitdiff
path: root/src/gallery-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallery-utils.c')
-rw-r--r--src/gallery-utils.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallery-utils.c b/src/gallery-utils.c
index 494900c..3caff02 100644
--- a/src/gallery-utils.c
+++ b/src/gallery-utils.c
@@ -365,3 +365,22 @@ needs_update (const gchar *source, const gchar *dest)
return (src_stat.st_mtime > dst_stat.st_mtime);
}
+
+/*
+ * clone_string_hash_table: clones data from existing string hash table and returns newly-allocated copy
+ */
+GHashTable *
+clone_string_hash_table (GHashTable *hash_table)
+{
+ GHashTable *dest;
+ GHashTableIter iter;
+ gchar *key, *value;
+
+ dest = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+ g_hash_table_iter_init (&iter, hash_table);
+ while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value))
+ g_hash_table_insert (dest, g_strdup (key), g_strdup (value));
+
+ return dest;
+}