diff options
Diffstat (limited to 'src/common/container.c')
-rw-r--r-- | src/common/container.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/common/container.c b/src/common/container.c index 7f02dec550..f7dfc69c2f 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -28,8 +28,8 @@ /** Allocate and return an empty smartlist. */ -smartlist_t * -smartlist_new(void) +MOCK_IMPL(smartlist_t *, +smartlist_new,(void)) { smartlist_t *sl = tor_malloc(sizeof(smartlist_t)); sl->num_used = 0; @@ -41,8 +41,8 @@ smartlist_new(void) /** Deallocate a smartlist. Does not release storage associated with the * list's elements. */ -void -smartlist_free(smartlist_t *sl) +MOCK_IMPL(void, +smartlist_free,(smartlist_t *sl)) { if (!sl) return; @@ -1052,18 +1052,18 @@ digestmap_entry_hash(const digestmap_entry_t *a) HT_PROTOTYPE(strmap_impl, strmap_entry_t, node, strmap_entry_hash, strmap_entries_eq) -HT_GENERATE(strmap_impl, strmap_entry_t, node, strmap_entry_hash, - strmap_entries_eq, 0.6, malloc, realloc, free) +HT_GENERATE2(strmap_impl, strmap_entry_t, node, strmap_entry_hash, + strmap_entries_eq, 0.6, tor_reallocarray_, tor_free_) HT_PROTOTYPE(digestmap_impl, digestmap_entry_t, node, digestmap_entry_hash, digestmap_entries_eq) -HT_GENERATE(digestmap_impl, digestmap_entry_t, node, digestmap_entry_hash, - digestmap_entries_eq, 0.6, malloc, realloc, free) +HT_GENERATE2(digestmap_impl, digestmap_entry_t, node, digestmap_entry_hash, + digestmap_entries_eq, 0.6, tor_reallocarray_, tor_free_) /** Constructor to create a new empty map from strings to void*'s. */ -strmap_t * -strmap_new(void) +MOCK_IMPL(strmap_t *, +strmap_new,(void)) { strmap_t *result; result = tor_malloc(sizeof(strmap_t)); @@ -1073,8 +1073,8 @@ strmap_new(void) /** Constructor to create a new empty map from digests to void*'s. */ -digestmap_t * -digestmap_new(void) +MOCK_IMPL(digestmap_t *, +digestmap_new,(void)) { digestmap_t *result; result = tor_malloc(sizeof(digestmap_t)); @@ -1427,8 +1427,8 @@ digestmap_iter_done(digestmap_iter_t *iter) * entries. If free_val is provided, it is invoked on every value in * <b>map</b>. */ -void -strmap_free(strmap_t *map, void (*free_val)(void*)) +MOCK_IMPL(void, +strmap_free,(strmap_t *map, void (*free_val)(void*))) { strmap_entry_t **ent, **next, *this; if (!map) @@ -1451,8 +1451,8 @@ strmap_free(strmap_t *map, void (*free_val)(void*)) * entries. If free_val is provided, it is invoked on every value in * <b>map</b>. */ -void -digestmap_free(digestmap_t *map, void (*free_val)(void*)) +MOCK_IMPL(void, +digestmap_free, (digestmap_t *map, void (*free_val)(void*))) { digestmap_entry_t **ent, **next, *this; if (!map) |