1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Option for bitset memory allocation using malloc as well as pool.

This commit is contained in:
Alasdair Kergon 2005-09-16 18:40:53 +00:00
parent dbb43034e6
commit 7c2ef08367

View File

@ -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;
}