From c92c8c6913ee074a2338e5b021b82b934349e382 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Mon, 27 Apr 2020 16:14:17 +0200 Subject: [PATCH] Marking resource functions with non-NULL compiler flags --- lib/mempool.c | 4 ++-- lib/resource.c | 4 ++-- lib/resource.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/mempool.c b/lib/mempool.c index 758882ce..587e7a2d 100644 --- a/lib/mempool.c +++ b/lib/mempool.c @@ -65,8 +65,8 @@ static struct resclass lp_class = { * The linear pool consists of a list of memory chunks of size at least * @blk. */ -linpool -*lp_new(pool *p, uint blk) +linpool * NONNULL(1) +lp_new(pool *p, uint blk) { linpool *m = ralloc(p, &lp_class); m->chunk_size = blk; diff --git a/lib/resource.c b/lib/resource.c index 5589373e..f63b5371 100644 --- a/lib/resource.c +++ b/lib/resource.c @@ -334,7 +334,7 @@ static struct resclass mb_class = { * chunk, not to the resource, hence you have to free it using * mb_free(), not rfree(). */ -void * +void * NONNULL(1) mb_alloc(pool *p, unsigned size) { struct mblock *b = xmalloc(sizeof(struct mblock) + size); @@ -359,7 +359,7 @@ mb_alloc(pool *p, unsigned size) * chunk, not to the resource, hence you have to free it using * mb_free(), not rfree(). */ -void * +void * NONNULL(1) mb_allocz(pool *p, unsigned size) { void *x = mb_alloc(p, size); diff --git a/lib/resource.h b/lib/resource.h index ad17d9ed..2f018b69 100644 --- a/lib/resource.h +++ b/lib/resource.h @@ -50,8 +50,8 @@ extern pool root_pool; /* Normal memory blocks */ -void *mb_alloc(pool *, unsigned size); -void *mb_allocz(pool *, unsigned size); +void *mb_alloc(pool *, unsigned size) NONNULL(1); +void *mb_allocz(pool *, unsigned size) NONNULL(1); void *mb_realloc(void *m, unsigned size); void mb_free(void *); @@ -64,7 +64,7 @@ typedef struct lp_state { byte *ptr; } lp_state; -linpool *lp_new(pool *, unsigned blk); +linpool *lp_new(pool *, unsigned blk) NONNULL(1); void *lp_alloc(linpool *, unsigned size); /* Aligned */ void *lp_allocu(linpool *, unsigned size); /* Unaligned */ void *lp_allocz(linpool *, unsigned size); /* With clear */