aboutgitcodebugslistschat
path: root/util.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-06-06 20:09:46 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-06-07 20:44:44 +0200
commitbda80ef53f5b85917773ccebd3008f560658e342 (patch)
tree4d58ad4767da92fc2f0457a14e6a9bbcb2dc1fc9 /util.h
parent0e36fe1a4350dcdde2cc09eb7ba9c99361996ab9 (diff)
downloadpasst-bda80ef53f5b85917773ccebd3008f560658e342.tar
passt-bda80ef53f5b85917773ccebd3008f560658e342.tar.gz
passt-bda80ef53f5b85917773ccebd3008f560658e342.tar.bz2
passt-bda80ef53f5b85917773ccebd3008f560658e342.tar.lz
passt-bda80ef53f5b85917773ccebd3008f560658e342.tar.xz
passt-bda80ef53f5b85917773ccebd3008f560658e342.tar.zst
passt-bda80ef53f5b85917773ccebd3008f560658e342.zip
util: Use unsigned indices for bits in bitmaps
A negative bit index in a bitmap doesn't make sense. Avoid this by construction by using unsigned indices. While we're there adjust bitmap_isset() to return a bool instead of an int. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.h')
-rw-r--r--util.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/util.h b/util.h
index aa6e4b4..cf9c4b6 100644
--- a/util.h
+++ b/util.h
@@ -148,9 +148,9 @@ int sock_l4(const struct ctx *c, sa_family_t af, uint8_t proto,
uint32_t data);
void sock_probe_mem(struct ctx *c);
int timespec_diff_ms(const struct timespec *a, const struct timespec *b);
-void bitmap_set(uint8_t *map, int bit);
-void bitmap_clear(uint8_t *map, int bit);
-int bitmap_isset(const uint8_t *map, int bit);
+void bitmap_set(uint8_t *map, unsigned bit);
+void bitmap_clear(uint8_t *map, unsigned bit);
+bool bitmap_isset(const uint8_t *map, unsigned bit);
void bitmap_or(uint8_t *dst, size_t size, const uint8_t *a, const uint8_t *b);
char *line_read(char *buf, size_t len, int fd);
void ns_enter(const struct ctx *c);