diff options
author | dimitri staessens <[email protected]> | 2016-05-08 16:14:35 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-05-08 16:14:35 +0200 |
commit | 7d0fcf6392be6a738d0ba7450b62f8c48062279a (patch) | |
tree | 7d098bb422be8597dd2a30a60a08a44a89d5ebf6 /src/lib/bitmap.c | |
parent | eb9f44379d5316e7f7e9311d7a66d2041eca743a (diff) | |
download | ouroboros-7d0fcf6392be6a738d0ba7450b62f8c48062279a.tar.gz ouroboros-7d0fcf6392be6a738d0ba7450b62f8c48062279a.zip |
lib/irmd/ipcpd/tools: fixes comments on eb9f443
Diffstat (limited to 'src/lib/bitmap.c')
-rw-r--r-- | src/lib/bitmap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c index 0e3c968f..e84145b2 100644 --- a/src/lib/bitmap.c +++ b/src/lib/bitmap.c @@ -112,7 +112,7 @@ struct bmp * bmp_create(size_t bits, ssize_t offset) return NULL; tmp->bitmap = malloc(BITS_TO_LONGS(bits) * sizeof(unsigned long)); - if (!tmp->bitmap) { + if (tmp->bitmap == NULL) { free(tmp); return NULL; } @@ -142,6 +142,9 @@ int bmp_destroy(struct bmp * b) static ssize_t bad_id(struct bmp * b) { + if (b == NULL) + return -1; + return b->offset - 1; } @@ -177,7 +180,7 @@ static bool is_id_valid(struct bmp * b, bool bmp_is_id_valid(struct bmp * b, ssize_t id) { - if (!b) + if (b == NULL) return false; return is_id_valid(b, id); @@ -188,7 +191,7 @@ int bmp_release(struct bmp * b, { ssize_t rid; - if (!b) + if (b == NULL) return -1; if (!is_id_valid(b, id)) |