From 24d88189331ab9a73712af4ab3b82e89ac0eeb65 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 19 Apr 2010 21:08:32 +0000 Subject: [PATCH] Simplify dm_bitset_create. (ejt) --- libdm/datastruct/bitset.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libdm/datastruct/bitset.c b/libdm/datastruct/bitset.c index e3c31d75c..e8bec2ab7 100644 --- a/libdm/datastruct/bitset.c +++ b/libdm/datastruct/bitset.c @@ -26,17 +26,14 @@ dm_bitset_t dm_bitset_create(struct dm_pool *mem, unsigned num_bits) if (mem) bs = dm_pool_zalloc(mem, size); - else - bs = dm_malloc(size); + else if ((bs = dm_malloc(size))) + memset(mem, 0, size); if (!bs) return NULL; *bs = num_bits; - if (!mem) - dm_bit_clear_all(bs); - return bs; } -- 2.43.5