From: Volker Lendecke Date: Wed, 29 Oct 2025 12:45:18 +0000 (+0100) Subject: lib: Add some const to bitmap functions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f618ef8db916ba1ef65c04e185457de59f3ace1;p=thirdparty%2Fsamba.git lib: Add some const to bitmap functions The unusual use of const comes from bitmap_copy :-) Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/lib/util/bitmap.c b/lib/util/bitmap.c index 82cf55e459a..83e0b2ca25a 100644 --- a/lib/util/bitmap.c +++ b/lib/util/bitmap.c @@ -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; diff --git a/lib/util/bitmap.h b/lib/util/bitmap.h index be6d028c186..664284cd8a8 100644 --- a/lib/util/bitmap.h +++ b/lib/util/bitmap.h @@ -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);