From: Zbigniew Jędrzejewski-Szmek Date: Mon, 13 Oct 2025 17:23:55 +0000 (+0200) Subject: basic/mempool: mark mempool_enabled as _pure_ X-Git-Tag: v258.2~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=29cbe93ea5e845f6621c44dd73b0f3ebfbe7ddf4;p=thirdparty%2Fsystemd.git basic/mempool: mark mempool_enabled as _pure_ The function internally does caching which means that the result must always be the same, the definition of a pure function. The compiler might be able to optimize some repeated calls to the function. (cherry picked from commit 882dfbde1c3159689eabadfab430aa9c272af163) --- diff --git a/src/basic/mempool.h b/src/basic/mempool.h index 69fbae18a5f..3817b0c5b96 100644 --- a/src/basic/mempool.h +++ b/src/basic/mempool.h @@ -22,6 +22,6 @@ static struct mempool pool_name = { \ .at_least = alloc_at_least, \ } -__attribute__((weak)) bool mempool_enabled(void); +bool mempool_enabled(void) _weak_ _pure_; void mempool_trim(struct mempool *mp);