diff options
author | Ben Pfaff <blp@nicira.com> | 2009-06-24 10:21:39 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2009-07-06 09:07:23 -0700 |
commit | 7efc68eb075acfe3c00fbe1a8ed2146c445f1139 (patch) | |
tree | 043fa5b4ab5924c7fa4444313d7ac9f85064d3cb /lib | |
parent | 732dcb37a81c657fa587650bbf237e5f9c2bbc0d (diff) | |
download | openvswitch-7efc68eb075acfe3c00fbe1a8ed2146c445f1139.tar.gz |
shash: New function shash_first().
Diffstat (limited to 'lib')
-rw-r--r-- | lib/shash.c | 8 | ||||
-rw-r--r-- | lib/shash.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/shash.c b/lib/shash.c index 7f6908436..931637276 100644 --- a/lib/shash.c +++ b/lib/shash.c @@ -97,3 +97,11 @@ shash_find_data(const struct shash *sh, const char *name) struct shash_node *node = shash_find(sh, name); return node ? node->data : NULL; } + +struct shash_node * +shash_first(const struct shash *shash) +{ + struct hmap_node *node = hmap_first(&shash->map); + return node ? CONTAINER_OF(node, struct shash_node, node) : NULL; +} + diff --git a/lib/shash.h b/lib/shash.h index 469e66e55..bcac41b57 100644 --- a/lib/shash.h +++ b/lib/shash.h @@ -39,5 +39,6 @@ void shash_add(struct shash *, const char *, void *); void shash_delete(struct shash *, struct shash_node *); struct shash_node *shash_find(const struct shash *, const char *); void *shash_find_data(const struct shash *, const char *); +struct shash_node *shash_first(const struct shash *); #endif /* shash.h */ |