aboutsummaryrefslogtreecommitdiff
path: root/src/common/container.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-10-31 10:54:12 -0400
committerNick Mathewson <nickm@torproject.org>2014-10-31 10:54:12 -0400
commit542b4701644224bf096599931a61dbae645aa2cd (patch)
tree8b55720e2a542deaa9a2d23a181ecc8e628b234d /src/common/container.h
parent5ad87218389050fef48b1a123aab1260cdfb8d7c (diff)
downloadtor-542b4701644224bf096599931a61dbae645aa2cd.tar.gz
tor-542b4701644224bf096599931a61dbae645aa2cd.zip
Refactor {str,digest}map into a common implementation; add digest256map
Needed for #13399.
Diffstat (limited to 'src/common/container.h')
-rw-r--r--src/common/container.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common/container.h b/src/common/container.h
index def3d76944..d3d20af5b2 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -346,6 +346,9 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join,
DECLARE_MAP_FNS(strmap_t, const char *, strmap_);
/* Map from const char[DIGEST_LEN] to void *. Implemented with a hash table. */
DECLARE_MAP_FNS(digestmap_t, const char *, digestmap_);
+/* Map from const uint8_t[DIGEST_LEN] to void *. Implemented with a hash
+ * table. */
+DECLARE_MAP_FNS(digest256map_t, const uint8_t *, digest256map_);
#undef DECLARE_MAP_FNS
@@ -461,6 +464,13 @@ DECLARE_MAP_FNS(digestmap_t, const char *, digestmap_);
/** Used to end a DIGESTMAP_FOREACH() block. */
#define DIGESTMAP_FOREACH_END MAP_FOREACH_END
+#define DIGEST256MAP_FOREACH(map, keyvar, valtype, valvar) \
+ MAP_FOREACH(digest256map_, map, const uint8_t *, keyvar, valtype, valvar)
+#define DIGEST256MAP_FOREACH_MODIFY(map, keyvar, valtype, valvar) \
+ MAP_FOREACH_MODIFY(digest256map_, map, const uint8_t *, \
+ keyvar, valtype, valvar)
+#define DIGEST256MAP_FOREACH_END MAP_FOREACH_END
+
#define STRMAP_FOREACH(map, keyvar, valtype, valvar) \
MAP_FOREACH(strmap_, map, const char *, keyvar, valtype, valvar)
#define STRMAP_FOREACH_MODIFY(map, keyvar, valtype, valvar) \