if (!ret->bitmaps)
return mfree(ret);
- ret->n_bitmaps = ret->bitmaps_allocated = b->n_bitmaps;
+ ret->n_bitmaps = b->n_bitmaps;
return ret;
}
offset = BITMAP_NUM_TO_OFFSET(n);
if (offset >= b->n_bitmaps) {
- if (!GREEDY_REALLOC0(b->bitmaps, b->bitmaps_allocated, offset + 1))
+ if (!GREEDY_REALLOC0(b->bitmaps, offset + 1))
return -ENOMEM;
b->n_bitmaps = offset + 1;
b->bitmaps = mfree(b->bitmaps);
b->n_bitmaps = 0;
- b->bitmaps_allocated = 0;
}
bool bitmap_iterate(const Bitmap *b, Iterator *i, unsigned *n) {
rem = BITMAP_NUM_TO_REM(i->idx);
bitmask = UINT64_C(1) << rem;
- for (; offset < b->n_bitmaps; offset ++) {
+ for (; offset < b->n_bitmaps; offset++) {
if (b->bitmaps[offset]) {
- for (; bitmask; bitmask <<= 1, rem ++) {
+ for (; bitmask; bitmask <<= 1, rem++) {
if (b->bitmaps[offset] & bitmask) {
*n = BITMAP_OFFSET_TO_NUM(offset, rem);
i->idx = *n + 1;