X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fhashmap.c;h=53502576ad8b9773d08a528853ce7c27948c865c;hb=aca4c78676cd503079581fe878e06332ce6bb255;hp=4b187057ec34f8af4d5de0fcb7bbdff8159438dc;hpb=22be093ffb403a1c474037939ca9b88b1ee39f77;p=elogind.git 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; +}