X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fshash.h;h=c2d13b157f3f2870b0844fa65620b9599e4c045e;hb=8ecd53084ce42e2e868a9c24c57b2d9a7e59cfc2;hp=72d8302007462fb74f1d10066e04e77406182b3e;hpb=78299b0a6871a31c8b0cce5ef3f67ab465ab094f;p=openvswitch diff --git a/lib/shash.h b/lib/shash.h index 72d83020..c2d13b15 100644 --- a/lib/shash.h +++ b/lib/shash.h @@ -31,14 +31,24 @@ 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 *); +size_t shash_count(const struct shash *); 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 *); +void *shash_find_and_delete(struct shash *, const char *); struct shash_node *shash_first(const struct shash *); +const struct shash_node **shash_sort(const struct shash *); #endif /* shash.h */