From: Mike Yuan Date: Thu, 26 Mar 2026 16:23:47 +0000 (+0100) Subject: Revert "basic/allow-util: make free_many non-inline" X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=d5d76ddd804293237bae6d9877f4743cc2da8b65;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/basic/alloc-util.c b/src/basic/alloc-util.c index 3a813575c3a..04c4a506729 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 1f0342eda3f..8505205ce3c 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) {