]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Marking resource functions with non-NULL compiler flags
authorMaria Matejka <mq@ucw.cz>
Mon, 27 Apr 2020 14:14:17 +0000 (16:14 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 30 Apr 2020 15:38:30 +0000 (17:38 +0200)
lib/mempool.c
lib/resource.c
lib/resource.h

index 758882ce251251821ebcf483cdfadf2f46aef1c0..587e7a2d88246bfb45ef40a664cf2a4252c8d7fc 100644 (file)
@@ -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;
index 5589373e01a5a160cdea3022a47955a7c73590f8..f63b53717b75b404a727f29fe39df4e1f34ae68b 100644 (file)
@@ -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);
index ad17d9ed45be5da41017935639124ae988c838bd..2f018b69dc1604497f69ff202d82c38359d3eea6 100644 (file)
@@ -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 */