hashmap: add hashmap_first_key()

This commit is contained in:
Lennart Poettering 2011-12-19 19:54:51 +01:00
parent 5079a105e7
commit 2e4a6ff47b
2 changed files with 12 additions and 0 deletions

View file

@ -558,6 +558,17 @@ void* hashmap_first(Hashmap *h) {
return h->iterate_list_head->value;
}
void* hashmap_first_key(Hashmap *h) {
if (!h)
return NULL;
if (!h->iterate_list_head)
return NULL;
return (void*) h->iterate_list_head->key;
}
void* hashmap_last(Hashmap *h) {
if (!h)

View file

@ -74,6 +74,7 @@ void hashmap_clear(Hashmap *h);
void *hashmap_steal_first(Hashmap *h);
void *hashmap_steal_first_key(Hashmap *h);
void* hashmap_first(Hashmap *h);
void* hashmap_first_key(Hashmap *h);
void* hashmap_last(Hashmap *h);
char **hashmap_get_strv(Hashmap *h);