diff options
author | Ben Pfaff <blp@nicira.com> | 2010-12-29 15:06:16 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-01-27 09:26:06 -0800 |
commit | c56d226f8d3fc7a68716be87e3d651be604213fa (patch) | |
tree | 393db5da968fc233a0b06a7bdcd7918749389201 /lib/shash.h | |
parent | 3476fce34e05af370e90961a9df4d237d6ca2e51 (diff) |
shash: New "smap" functions for working with string-to-string maps.
An shash always has string keys and sometimes it hash string values as
well. Usually the general-purpose shash functions are fine for working
with string-to-string maps, but this commit introduces a few more
specialized functions that only work with string-to-string maps. It's not
clear yet to me whether this should actually be a new data structure, so
for now the new functions just work on shashes.
This commit also converts one user of shash_destroy() to use smap_destroy().
This is the only existing user of these functions that I spotted as a
trivial conversion candidate while grepping.
These new functions will see more use in the following commit.
Reviewed by Justin Pettit.
Diffstat (limited to 'lib/shash.h')
-rw-r--r-- | lib/shash.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/shash.h b/lib/shash.h index dfb10e2c..1210772e 100644 --- a/lib/shash.h +++ b/lib/shash.h @@ -66,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 |