]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/mempool: mark mempool_enabled as _pure_
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 13 Oct 2025 17:23:55 +0000 (19:23 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 6 Nov 2025 21:26:42 +0000 (21:26 +0000)
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)

src/basic/mempool.h

index 69fbae18a5fcc55110027fda99eb9ca93bf76bf6..3817b0c5b969914d7e1dad7b2552ecaa3939d659 100644 (file)
@@ -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);