bitmap.c revision 951c3eefacedcdbdb2cebf245f043aa3e81fb483
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering This file is part of systemd.
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering Copyright 2015 Tom Gundersen
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering systemd is free software; you can redistribute it and/or modify it
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering under the terms of the GNU Lesser General Public License as published by
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering (at your option) any later version.
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering systemd is distributed in the hope that it will be useful, but
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering Lesser General Public License for more details.
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering You should have received a copy of the GNU Lesser General Public License
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
34e5a31ec5897de8ba1436dad53df99637569d0aLennart Poettering/* Bitmaps are only meant to store relatively small numbers
2e3d069236777cd62f755a02f4a239306b4ad21aLennart Poettering * (corresponding to, say, an enum), so it is ok to limit
free(b);
Bitmap *a;
assert(b);
a = bitmap_new();
return -ENOMEM;
unsigned offset;
assert(b);
if (n > BITMAPS_MAX_ENTRY)
return -ERANGE;
return -ENOMEM;
unsigned offset;
unsigned offset;
assert(b);
for (i = 0; i < b->n_bitmaps; i++)
if (b->bitmaps[i] != 0)
assert(b);
b->n_bitmaps = 0;
b->bitmaps_allocated = 0;
assert(i);
assert(n);
rem = 0;
Bitmap *c;
if (c->bitmaps[i] != 0)