From: Michael Beck Date: Mon, 17 Dec 2007 13:39:17 +0000 (+0000) Subject: use xmalloc instead of malloc X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=3bc57c55d2ea9194d5e09830a2f5b4b401149289;p=libfirm use xmalloc instead of malloc [r17001] --- diff --git a/include/libfirm/adt/raw_bitset.h b/include/libfirm/adt/raw_bitset.h index 8ffee7a8a..b709a1f02 100644 --- a/include/libfirm/adt/raw_bitset.h +++ b/include/libfirm/adt/raw_bitset.h @@ -44,10 +44,13 @@ #include "bitset.h" #include "obst.h" -#define BITS_PER_ELEM 32 -#define BITSET_SIZE_ELEMS(size_bits) ((size_bits)/32 + 1) -#define BITSET_SIZE_BYTES(size_bits) (BITSET_SIZE_ELEMS(size_bits)*4) -#define BITSET_ELEM(bitset,pos) bitset[pos / 32] +/** The base type for raw bitsets. */ +typedef unsigned int rawbs_base_t; + +#define BITS_PER_ELEM (sizeof(rawbs_base_t) * 8) +#define BITSET_SIZE_ELEMS(size_bits) ((size_bits)/BITS_PER_ELEM + 1) +#define BITSET_SIZE_BYTES(size_bits) (BITSET_SIZE_ELEMS(size_bits) * sizeof(rawbs_base_t)) +#define BITSET_ELEM(bitset,pos) bitset[pos / BITS_PER_ELEM] /** * Allocate an empty raw bitset on the heap. @@ -58,7 +61,7 @@ */ static INLINE unsigned *rbitset_malloc(unsigned size) { unsigned size_bytes = BITSET_SIZE_BYTES(size); - unsigned *res = malloc(size_bytes); + unsigned *res = xmalloc(size_bytes); memset(res, 0, size_bytes); return res;