X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fhashmap.c;fp=src%2Fhashmap.c;h=53502576ad8b9773d08a528853ce7c27948c865c;hp=4b187057ec34f8af4d5de0fcb7bbdff8159438dc;hb=db1413d7380acacc4e50faf801ca0d401da89764;hpb=3a90ae048233021833ae828c1fc6bf0eeab46197 diff --git a/src/hashmap.c b/src/hashmap.c index 4b187057e..53502576a 100644 --- a/src/hashmap.c +++ b/src/hashmap.c @@ -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; +}