chiark / gitweb /
sysctl.d, binfmt.d, modules-load.d: switch to stacked config dirs in /lib, /etc,...
[elogind.git] / src / hashmap.c
index 4b187057ec34f8af4d5de0fcb7bbdff8159438dc..53502576ad8b9773d08a528853ce7c27948c865c 100644 (file)
@@ -592,3 +592,21 @@ Hashmap *hashmap_copy(Hashmap *h) {
 
         return copy;
 }
+
+char **hashmap_get_strv(Hashmap *h) {
+        char **sv;
+        Iterator it;
+        char *path;
+        int n;
+
+        sv = malloc((h->n_entries+1) * sizeof(char *));
+        if (sv == NULL)
+                return NULL;
+
+        n = 0;
+        HASHMAP_FOREACH(path, h, it)
+                sv[n++] = path;
+        sv[n] = NULL;
+
+        return sv;
+}