diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-12-03 20:21:11 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-12-04 10:41:59 +0100 |
commit | 5517e214c8e6a18decf54884c9a5566fd7236764 (patch) | |
tree | 97901944f679c30aa6c51d93b482073f2af2e526 /src/journal | |
parent | e2f03674bc50263833ebc5b79a194cb667c0a244 (diff) | |
download | systemd-5517e214c8e6a18decf54884c9a5566fd7236764.tar.gz |
tree-wide: make use of new DLSYM_ARG() macro everywhere
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/pcre2-dlopen.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/journal/pcre2-dlopen.c b/src/journal/pcre2-dlopen.c index fbe81f99eb..5f78f76672 100644 --- a/src/journal/pcre2-dlopen.c +++ b/src/journal/pcre2-dlopen.c @@ -27,16 +27,24 @@ int dlopen_pcre2(void) { return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "PCRE2 support is not installed: %s", dlerror()); + /* So here's something weird: PCRE2 actually renames the symbols exported by the library via C + * macros, so that the exported symbols carry a suffix "_8" but when used from C the suffix is + * gone. In the argument list below we ignore this mangling. Surprisingly (at least to me), we + * actually get away with that. That's because DLSYM_ARG() useses STRINGIFY() to generate a string + * version of the symbol name, and that resolves the macro mapping implicitly already, so that the + * string actually contains the "_8" suffix already due to that and we don't have to append it + * manually anymore. C is weird. 🤯 */ + r = dlsym_many_and_warn( dl, LOG_ERR, - &sym_pcre2_match_data_create, "pcre2_match_data_create_8", - &sym_pcre2_match_data_free, "pcre2_match_data_free_8", - &sym_pcre2_code_free, "pcre2_code_free_8", - &sym_pcre2_compile, "pcre2_compile_8", - &sym_pcre2_get_error_message, "pcre2_get_error_message_8", - &sym_pcre2_match, "pcre2_match_8", - &sym_pcre2_get_ovector_pointer, "pcre2_get_ovector_pointer_8", + DLSYM_ARG(pcre2_match_data_create), + DLSYM_ARG(pcre2_match_data_free), + DLSYM_ARG(pcre2_code_free), + DLSYM_ARG(pcre2_compile), + DLSYM_ARG(pcre2_get_error_message), + DLSYM_ARG(pcre2_match), + DLSYM_ARG(pcre2_get_ovector_pointer), NULL); if (r < 0) return r; |