From 7ee95a3809aab3152837ceb5ffcd001ee9e83fde Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sat, 23 Sep 2017 12:27:23 +0200 Subject: lib: Clean up bitmap implementation There was a return -1 in the allocate call which is unsafe since -1 may be a valid id in the bitmap. Since it's a data structure for internal use, I replaced the NULL checks with assertions. --- include/ouroboros/bitmap.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/ouroboros/bitmap.h b/include/ouroboros/bitmap.h index a5921fc7..d40bb509 100644 --- a/include/ouroboros/bitmap.h +++ b/include/ouroboros/bitmap.h @@ -32,17 +32,17 @@ struct bmp; struct bmp * bmp_create(size_t bits, ssize_t offset); -void bmp_destroy(struct bmp * b); +void bmp_destroy(struct bmp * bmp); -ssize_t bmp_allocate(struct bmp * instance); +ssize_t bmp_allocate(struct bmp * bmp); -int bmp_release(struct bmp * instance, +int bmp_release(struct bmp * bmp, ssize_t id); -bool bmp_is_id_valid(struct bmp * b, +bool bmp_is_id_valid(struct bmp * bmp, ssize_t id); -bool bmp_is_id_used(struct bmp * b, +bool bmp_is_id_used(struct bmp * bmp, ssize_t id); #endif /* OUROBOROS_BITMAP_H */ -- cgit v1.2.3