diff options
author | Joe Thornber <ejt@redhat.com> | 2018-06-08 13:40:53 +0100 |
---|---|---|
committer | Joe Thornber <ejt@redhat.com> | 2018-06-08 13:40:53 +0100 |
commit | d5da55ed85248adb066d293c2a1b863ce17d2779 (patch) | |
tree | e526dd2f773e3016a3acd3cb8e490ed11ba7c439 /device_mapper/datastruct | |
parent | c78239d8605f333915543c0e0c3ccf4f4ef5ee8f (diff) | |
download | lvm2-d5da55ed85248adb066d293c2a1b863ce17d2779.tar.gz |
device_mapper: remove dbg_malloc.
I wrote dbg_malloc before we had valgrind. These days there's just
no need.
Diffstat (limited to 'device_mapper/datastruct')
-rw-r--r-- | device_mapper/datastruct/bitset.c | 5 | ||||
-rw-r--r-- | device_mapper/datastruct/hash.c | 21 |
2 files changed, 14 insertions, 12 deletions
diff --git a/device_mapper/datastruct/bitset.c b/device_mapper/datastruct/bitset.c index f093ac0cb..fc2c3c39c 100644 --- a/device_mapper/datastruct/bitset.c +++ b/device_mapper/datastruct/bitset.c @@ -14,6 +14,7 @@ */ #include "device_mapper/misc/dmlib.h" +#include "base/memory/zalloc.h" #include <ctype.h> @@ -29,7 +30,7 @@ dm_bitset_t dm_bitset_create(struct dm_pool *mem, unsigned num_bits) if (mem) bs = dm_pool_zalloc(mem, size); else - bs = dm_zalloc(size); + bs = zalloc(size); if (!bs) return NULL; @@ -41,7 +42,7 @@ dm_bitset_t dm_bitset_create(struct dm_pool *mem, unsigned num_bits) void dm_bitset_destroy(dm_bitset_t bs) { - dm_free(bs); + free(bs); } int dm_bitset_equal(dm_bitset_t in1, dm_bitset_t in2) diff --git a/device_mapper/datastruct/hash.c b/device_mapper/datastruct/hash.c index 59e719baa..f16508aa8 100644 --- a/device_mapper/datastruct/hash.c +++ b/device_mapper/datastruct/hash.c @@ -14,6 +14,7 @@ */ #include "device_mapper/misc/dmlib.h" +#include "base/memory/zalloc.h" struct dm_hash_node { struct dm_hash_node *next; @@ -59,7 +60,7 @@ static unsigned char _nums[] = { static struct dm_hash_node *_create_node(const char *str, unsigned len) { - struct dm_hash_node *n = dm_malloc(sizeof(*n) + len); + struct dm_hash_node *n = malloc(sizeof(*n) + len); if (n) { memcpy(n->key, str, len); @@ -91,7 +92,7 @@ struct dm_hash_table *dm_hash_create(unsigned size_hint) { size_t len; unsigned new_size = 16u; - struct dm_hash_table *hc = dm_zalloc(sizeof(*hc)); + struct dm_hash_table *hc = zalloc(sizeof(*hc)); if (!hc) return_0; @@ -102,14 +103,14 @@ struct dm_hash_table *dm_hash_create(unsigned size_hint) hc->num_slots = new_size; len = sizeof(*(hc->slots)) * new_size; - if (!(hc->slots = dm_zalloc(len))) + if (!(hc->slots = zalloc(len))) goto_bad; return hc; bad: - dm_free(hc->slots); - dm_free(hc); + free(hc->slots); + free(hc); return 0; } @@ -121,15 +122,15 @@ static void _free_nodes(struct dm_hash_table *t) for (i = 0; i < t->num_slots; i++) for (c = t->slots[i]; c; c = n) { n = c->next; - dm_free(c); + free(c); } } void dm_hash_destroy(struct dm_hash_table *t) { _free_nodes(t); - dm_free(t->slots); - dm_free(t); + free(t->slots); + free(t); } static struct dm_hash_node **_find(struct dm_hash_table *t, const void *key, @@ -187,7 +188,7 @@ void dm_hash_remove_binary(struct dm_hash_table *t, const void *key, if (*c) { struct dm_hash_node *old = *c; *c = (*c)->next; - dm_free(old); + free(old); t->num_nodes--; } } @@ -287,7 +288,7 @@ void dm_hash_remove_with_val(struct dm_hash_table *t, const char *key, if (c && *c) { struct dm_hash_node *old = *c; *c = (*c)->next; - dm_free(old); + free(old); t->num_nodes--; } } |