From 05fb03beeecd730e5525253b9c3c8706e1834b09 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 23 Jul 2015 04:51:57 +0200 Subject: 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(). --- src/basic/bitmap.c | 5 +---- 1 file changed, 1 insertion(+), 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) { -- cgit v1.2.3-54-g00ecf