1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 18:55:40 +03:00

util-lib: make sure more bitmap calls can deal with NULL objects fine

This commit is contained in:
Lennart Poettering 2015-12-21 19:53:15 +01:00
parent 7b50eb2efa
commit 0b8086379f

View File

@ -140,7 +140,8 @@ bool bitmap_isset(Bitmap *b, unsigned n) {
bool bitmap_isclear(Bitmap *b) {
unsigned i;
assert(b);
if (!b)
return true;
for (i = 0; i < b->n_bitmaps; i++)
if (b->bitmaps[i] != 0)
@ -150,7 +151,9 @@ bool bitmap_isclear(Bitmap *b) {
}
void bitmap_clear(Bitmap *b) {
assert(b);
if (!b)
return;
b->bitmaps = mfree(b->bitmaps);
b->n_bitmaps = 0;