From d5d76ddd804293237bae6d9877f4743cc2da8b65 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Thu, 26 Mar 2026 17:23:47 +0100 Subject: [PATCH] Revert "basic/allow-util: make free_many non-inline" This reverts commit 3abe1e53f657982a7a6ab6861cf0b3962cbbb3b5. I remain unconvinced. The function is very short, and by making it inline the assert()s can be optimized away. --- src/basic/alloc-util.c | 7 ------- src/basic/alloc-util.h | 7 ++++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/basic/alloc-util.c b/src/basic/alloc-util.c index 3a813575c3..04c4a50672 100644 --- a/src/basic/alloc-util.c +++ b/src/basic/alloc-util.c @@ -164,10 +164,3 @@ void* greedy_realloc_append( return q; } - -void free_many(void **p, size_t n) { - assert(p || n == 0); - - FOREACH_ARRAY(i, p, n) - *i = mfree(*i); -} diff --git a/src/basic/alloc-util.h b/src/basic/alloc-util.h index 1f0342eda3..8505205ce3 100644 --- a/src/basic/alloc-util.h +++ b/src/basic/alloc-util.h @@ -208,7 +208,12 @@ void* greedy_realloc_append(void **p, size_t *n_p, const void *from, size_t n_fr #endif /* Free every element of the array. */ -void free_many(void **p, size_t n); +static inline void free_many(void **p, size_t n) { + assert(p || n == 0); + + FOREACH_ARRAY(i, p, n) + *i = mfree(*i); +} /* Typesafe wrapper for char** rather than void**. Unfortunately C won't implicitly cast this. */ static inline void free_many_charp(char **c, size_t n) {