From b01f31954f1c7c4601925173ae2638b572224e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 12 Jun 2022 16:52:57 +0200 Subject: Turn mempool_enabled() into a weak symbol Before we had the following scheme: mempool_enabled() would check mempool_use_allowed, and libsystemd-shared would be linked with a .c file that provides mempool_use_allowed=true, while other things would linked with a different .c file with mempool_use_allowed=false. In the new scheme, mempool_enabled() itself is a weak symbol. If it's not found, we assume false. So it only needs to be provided for libsystemd-shared, where it can return false or true. test-set-disable-mempool is libshared, so it gets the symbol. But then we actually disable the mempool via envvar. mempool_enable() is called to check its return value directly. --- src/basic/mempool.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/basic/mempool.h') diff --git a/src/basic/mempool.h b/src/basic/mempool.h index 0fe2f2789c..539ccbdf06 100644 --- a/src/basic/mempool.h +++ b/src/basic/mempool.h @@ -23,8 +23,7 @@ static struct mempool pool_name = { \ .at_least = alloc_at_least, \ } -extern const bool mempool_use_allowed; -bool mempool_enabled(void); +__attribute__((weak)) bool mempool_enabled(void); #if VALGRIND void mempool_drop(struct mempool *mp); -- cgit v1.2.1