X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fshash.c;h=7bb8cd70b9bb59e12a18bf57e9c42bb1af329f37;hb=d8ba4acf4494d381b3b789251274b9ca77578dd1;hp=93163727655a02ba633883015d755a4780b99d1d;hpb=a5e54d9b6f8002f34cc792df69e6eda68cf95223;p=openvswitch diff --git a/lib/shash.c b/lib/shash.c index 93163727..7bb8cd70 100644 --- a/lib/shash.c +++ b/lib/shash.c @@ -44,7 +44,7 @@ shash_clear(struct shash *sh) { struct shash_node *node, *next; - HMAP_FOR_EACH_SAFE (node, next, struct shash_node, node, &sh->map) { + SHASH_FOR_EACH_SAFE (node, next, sh) { hmap_remove(&sh->map, &node->node); free(node->name); free(node); @@ -57,15 +57,16 @@ shash_is_empty(const struct shash *shash) return hmap_is_empty(&shash->map); } -/* It is the caller's responsible to avoid duplicate names, if that is +/* It is the caller's responsibility to avoid duplicate names, if that is * desirable. */ -void +struct shash_node * shash_add(struct shash *sh, const char *name, void *data) { struct shash_node *node = xmalloc(sizeof *node); node->name = xstrdup(name); node->data = data; hmap_insert(&sh->map, &node->node, hash_name(name)); + return node; } void