summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-07-23 04:51:57 +0200
committerLennart Poettering <lennart@poettering.net>2015-07-23 04:51:57 +0200
commit05fb03beeecd730e5525253b9c3c8706e1834b09 (patch)
treefa422e1ff4d6d80a0aa28b7f510689cd1e3fe347
parent6aafa9483d167f55a50e01f4dc5984866f12c8ec (diff)
bitmap: bitmap_clear()
No need to actually reset the bitmap, we can just truncate it back zero size. That not only makes bitmap_clear() quicker, but also subsequent bitmap_isclear().
-rw-r--r--src/basic/bitmap.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/basic/bitmap.c b/src/basic/bitmap.c
index 0747749d13..7e47c2d09f 100644
--- a/src/basic/bitmap.c
+++ b/src/basic/bitmap.c
@@ -140,12 +140,9 @@ bool bitmap_isclear(Bitmap *b) {
}
void bitmap_clear(Bitmap *b) {
- unsigned i;
-
assert(b);
- for (i = 0; i < b->n_bitmaps; i++)
- b->bitmaps[i] = 0;
+ b->n_bitmaps = 0;
}
bool bitmap_iterate(Bitmap *b, Iterator *i, unsigned *n) {