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:
@@ -38,9 +38,6 @@
|
||||
|
||||
#if HAVE_ELFUTILS
|
||||
|
||||
static void *dw_dl = NULL;
|
||||
static void *elf_dl = NULL;
|
||||
|
||||
/* libdw symbols */
|
||||
static DLSYM_PROTOTYPE(dwarf_attr_integrate) = NULL;
|
||||
static DLSYM_PROTOTYPE(dwarf_diename) = NULL;
|
||||
@@ -96,6 +93,7 @@ static DLSYM_PROTOTYPE(gelf_getnote) = NULL;
|
||||
|
||||
int dlopen_dw(int log_level) {
|
||||
#if HAVE_ELFUTILS
|
||||
static void *dw_dl = NULL;
|
||||
int r;
|
||||
|
||||
SD_ELF_NOTE_DLOPEN(
|
||||
@@ -161,6 +159,7 @@ bool dlopen_dw_has_dwfl_set_sysroot(void) {
|
||||
|
||||
int dlopen_elf(int log_level) {
|
||||
#if HAVE_ELFUTILS
|
||||
static void *elf_dl = NULL;
|
||||
int r;
|
||||
|
||||
SD_ELF_NOTE_DLOPEN(
|
||||
|
||||
Reference in New Issue
Block a user