]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Add some const to bitmap functions
authorVolker Lendecke <vl@samba.org>
Wed, 29 Oct 2025 12:45:18 +0000 (13:45 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 10 Nov 2025 13:29:30 +0000 (13:29 +0000)
The unusual use of const comes from bitmap_copy :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
lib/util/bitmap.c
lib/util/bitmap.h

index 82cf55e459aa28cdca827317213a50d2aab76d39..83e0b2ca25a3da517050800255ee7aa6abb070e0 100644 (file)
@@ -99,7 +99,7 @@ bool bitmap_clear(struct bitmap *bm, unsigned i)
 /****************************************************************************
 query a bit in a bitmap
 ****************************************************************************/
-bool bitmap_query(struct bitmap *bm, unsigned i)
+bool bitmap_query(const struct bitmap * const bm, unsigned i)
 {
        if (i >= bm->n) return false;
        if (bm->b[i/32] & (1U<<(i%32))) {
@@ -112,7 +112,7 @@ bool bitmap_query(struct bitmap *bm, unsigned i)
 find a zero bit in a bitmap starting at the specified offset, with
 wraparound
 ****************************************************************************/
-int bitmap_find(struct bitmap *bm, unsigned ofs)
+int bitmap_find(const struct bitmap * const bm, unsigned ofs)
 {
        unsigned int i, j;
 
index be6d028c186cb10b640211e004b3e7fb23600be8..664284cd8a8f83ec4fb33a7b719da64db16582d3 100644 (file)
@@ -25,5 +25,5 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, unsigned n);
 int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
 bool bitmap_set(struct bitmap *bm, unsigned i);
 bool bitmap_clear(struct bitmap *bm, unsigned i);
-bool bitmap_query(struct bitmap *bm, unsigned i);
-int bitmap_find(struct bitmap *bm, unsigned ofs);
+bool bitmap_query(const struct bitmap * const bm, unsigned i);
+int bitmap_find(const struct bitmap * const bm, unsigned ofs);