diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-11-23 07:48:13 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-11-23 07:48:13 +0000 |
commit | 05482a08990a1603c3a6beed6bd1e6806ee4422e (patch) | |
tree | 1c530381d35935b1f50feb88e55e25ab026d6bd8 | |
parent | 0118a236a4fa3b3cbc5d3869e7ddc65f9a2480e3 (diff) | |
download | tor-05482a08990a1603c3a6beed6bd1e6806ee4422e.tar.gz tor-05482a08990a1603c3a6beed6bd1e6806ee4422e.zip |
Add functions to return number of elts in associative containers
svn:r5448
-rw-r--r-- | src/common/container.c | 12 | ||||
-rw-r--r-- | src/common/container.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/common/container.c b/src/common/container.c index 241dd977d3..b5bb6cd0bf 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -859,3 +859,15 @@ digestmap_isempty(digestmap_t *map) return HT_EMPTY(&map->head); } +int +strmap_size(strmap_t *map) +{ + return HT_SIZE(&map->head); +} + +int +digestmap_size(digestmap_t *map) +{ + return HT_SIZE(&map->head); +} + diff --git a/src/common/container.h b/src/common/container.h index e36df0bb5d..443a2ebcbc 100644 --- a/src/common/container.h +++ b/src/common/container.h @@ -117,6 +117,7 @@ char *smartlist_join_strings2(smartlist_t *sl, const char *join, void* prefix##remove(maptype *map, keytype key); \ void prefix##free(maptype *map, void (*free_val)(void*)); \ int prefix##isempty(maptype *map); \ + int prefix##size(maptype *map); \ prefix##iter_t *prefix##iter_init(maptype *map); \ 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); \ |