X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fshash.h;h=8efdde1b9ef0d6b2ab409066af71a5c65c616edb;hb=5e4641a147c3e450a56b199b9066f1af75c2f779;hp=469e66e55ddbf8d20c899a93f91544cd62c17489;hpb=732dcb37a81c657fa587650bbf237e5f9c2bbc0d;p=openvswitch diff --git a/lib/shash.h b/lib/shash.h index 469e66e5..8efdde1b 100644 --- a/lib/shash.h +++ b/lib/shash.h @@ -31,13 +31,25 @@ 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 *); +size_t shash_count(const struct shash *); +struct shash_node *shash_add(struct shash *, const char *, const void *); +bool shash_add_once(struct shash *, const char *, const 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 */