X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fshash.h;h=1210772ef19a1b2235c6a347d3f86b6407fc00a2;hb=e7668254f2f8f7208905c858ffbc84a65bb13815;hp=8a736e80bf9ef3f09e9c4e066ec467415367e7ff;hpb=4f2226487d3522654876885d769510b835c5f5ee;p=openvswitch diff --git a/lib/shash.h b/lib/shash.h index 8a736e80..1210772e 100644 --- a/lib/shash.h +++ b/lib/shash.h @@ -35,12 +35,11 @@ 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(SHASH_NODE, SHASH) \ + HMAP_FOR_EACH (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) +#define SHASH_FOR_EACH_SAFE(SHASH_NODE, NEXT, SHASH) \ + HMAP_FOR_EACH_SAFE (SHASH_NODE, NEXT, node, &(SHASH)->map) void shash_init(struct shash *); void shash_destroy(struct shash *); @@ -67,6 +66,12 @@ const struct shash_node **shash_sort(const struct shash *); bool shash_equal_keys(const struct shash *, const struct shash *); struct shash_node *shash_random_node(struct shash *); +/* Working with "smaps": shashes used as string-to-string maps. */ +void smap_destroy(struct shash *); +bool smap_equal(const struct shash *, const struct shash *); +void smap_clone(struct shash *, const struct shash *); +void smap_add(struct shash *, const char *key, const char *value); + #ifdef __cplusplus } #endif