tree-wide: move static dl handles into their dlopen_*() functions

Each dlopen_*() wrapper kept its dl handle as a file-scope
'static void *xxx_dl = NULL;' even though only the wrapper itself
ever referenced it. Move each one inside the corresponding function
so its scope matches its actual use, leaving the rest of each
translation unit free of the unused file-scope name.

In pcre2-util.c the assert(pcre2_dl) in pattern_matches_and_log()
becomes assert(sym_pcre2_match), which carries the same invariant
(pattern_compile_and_log() ran dlopen_pcre2()).
This commit is contained in:
Daan De Meyer
2026-05-19 19:22:06 +00:00
parent e62fd8106f
commit d158595dc7
30 changed files with 71 additions and 72 deletions
+2 -2
View File
@@ -9,8 +9,6 @@
#if HAVE_GCRYPT
static void *gcrypt_dl = NULL;
static DLSYM_PROTOTYPE(gcry_control) = NULL;
static DLSYM_PROTOTYPE(gcry_check_version) = NULL;
DLSYM_PROTOTYPE(gcry_md_close) = NULL;
@@ -47,6 +45,8 @@ DLSYM_PROTOTYPE(gcry_strerror) = NULL;
int dlopen_gcrypt(int log_level) {
#if HAVE_GCRYPT
static void *gcrypt_dl = NULL;
SD_ELF_NOTE_DLOPEN(
"gcrypt",
"Support for journald forward-sealing",