summaryrefslogtreecommitdiff
path: root/lib/datastruct
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2005-09-16 18:40:53 +0000
committerAlasdair Kergon <agk@redhat.com>2005-09-16 18:40:53 +0000
commit7c2ef083677c354596d3ab3ffec65688e8bdc6f4 (patch)
treeb84f02724f70efa478b37feda67cc201f071b859 /lib/datastruct
parentdbb43034e6cb6e6198ef5023bec19a93a6717328 (diff)
downloadlvm2-7c2ef083677c354596d3ab3ffec65688e8bdc6f4.tar.gz
Option for bitset memory allocation using malloc as well as pool.
Diffstat (limited to 'lib/datastruct')
-rw-r--r--lib/datastruct/bitset.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/datastruct/bitset.c b/lib/datastruct/bitset.c
index ed712a9cb..57fe90d5f 100644
--- a/lib/datastruct/bitset.c
+++ b/lib/datastruct/bitset.c
@@ -23,12 +23,21 @@ bitset_t bitset_create(struct pool *mem, unsigned num_bits)
{
unsigned n = (num_bits / BITS_PER_INT) + 2;
size_t size = sizeof(int) * n;
- unsigned *bs = pool_zalloc(mem, size);
+ bitset_t bs;
+
+ if (mem)
+ bs = pool_zalloc(mem, size);
+ else
+ bs = dbg_malloc(size);
if (!bs)
return NULL;
*bs = num_bits;
+
+ if (!mem)
+ bit_clear_all(bs);
+
return bs;
}