diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-07-31 18:01:27 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-07-31 18:01:27 +0000 |
commit | d934607069c77d6cf4caf9061e43d6d20c5aa111 (patch) | |
tree | be3079405369d40605dacfea5dce0a0bf6fddf26 /src/common | |
parent | 3843b1b3d09ca9d6546bfcf8e5f3bc10de4c2748 (diff) | |
download | tor-d934607069c77d6cf4caf9061e43d6d20c5aa111.tar.gz tor-d934607069c77d6cf4caf9061e43d6d20c5aa111.zip |
r6979@Kushana: nickm | 2006-07-31 13:16:58 -0400
Add assert_ok functions for strmap and digestmap; use them in unit test code.
svn:r6958
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/container.c | 11 | ||||
-rw-r--r-- | src/common/container.h | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/common/container.c b/src/common/container.c index d8ce9d654b..1e1fd985b1 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -965,6 +965,17 @@ digestmap_free(digestmap_t *map, void (*free_val)(void*)) tor_free(map); } +void +strmap_assert_ok(strmap_t *map) +{ + tor_assert(!_strmap_impl_HT_REP_IS_BAD(&map->head)); +} +void +digestmap_assert_ok(digestmap_t *map) +{ + tor_assert(!_digestmap_impl_HT_REP_IS_BAD(&map->head)); +} + /** Return true iff <b>map</b> has no entries. */ int strmap_isempty(strmap_t *map) diff --git a/src/common/container.h b/src/common/container.h index 0b5d0618af..85072e644a 100644 --- a/src/common/container.h +++ b/src/common/container.h @@ -134,7 +134,8 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join, prefix##iter_t *prefix##iter_next(maptype *map, prefix##iter_t *iter); \ prefix##iter_t *prefix##iter_next_rmv(maptype *map, prefix##iter_t *iter); \ void prefix##iter_get(prefix##iter_t *iter, keytype *keyp, void **valp); \ - int prefix##iter_done(prefix##iter_t *iter); + int prefix##iter_done(prefix##iter_t *iter); \ + void prefix##assert_ok(maptype *map); /* Map from const char * to void *. Implemented with a hash table. */ DECLARE_MAP_FNS(strmap_t, const char *, strmap_); |