X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fshash.h;h=5794a20f4d3b0659e3bf7533fff228e734327459;hb=3f355f47f8e7343e909ccfa854454d667baf3c38;hp=bcac41b5760d2bac34f856dc2598a5e21805232f;hpb=3b01baa3970139c3a195017ab1ea3e42761e3db2;p=openvswitch diff --git a/lib/shash.h b/lib/shash.h index bcac41b5..5794a20f 100644 --- a/lib/shash.h +++ b/lib/shash.h @@ -31,11 +31,18 @@ struct shash { #define SHASH_INITIALIZER(SHASH) { HMAP_INITIALIZER(&(SHASH)->map) } +#define SHASH_FOR_EACH(SHASH_NODE, SHASH) \ + HMAP_FOR_EACH (SHASH_NODE, struct shash_node, node, &(SHASH)->map) + +#define SHASH_FOR_EACH_SAFE(SHASH_NODE, NEXT, SHASH) \ + HMAP_FOR_EACH_SAFE (SHASH_NODE, NEXT, struct shash_node, node, \ + &(SHASH)->map) + void shash_init(struct shash *); void shash_destroy(struct shash *); void shash_clear(struct shash *); bool shash_is_empty(const struct shash *); -void shash_add(struct shash *, const char *, void *); +struct shash_node *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 *);