]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: make use of new DLSYM_ARG() macro everywhere 17843/head
authorLennart Poettering <lennart@poettering.net>
Thu, 3 Dec 2020 19:21:11 +0000 (20:21 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 4 Dec 2020 09:41:59 +0000 (10:41 +0100)
src/journal/pcre2-dlopen.c
src/shared/cryptsetup-util.c
src/shared/idn-util.c
src/shared/pwquality-util.c
src/shared/qrcode-util.c

index fbe81f99eb44a098464e8f6831d5b943305f2f66..5f78f76672a888ab9583a81dfab846da802610ff 100644 (file)
@@ -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;
index 34a078e7e77e571c42266e6dfd7478935e358f1a..b02d95ac55405dd05b118e5db7db1ca232fe19a5 100644 (file)
@@ -43,25 +43,25 @@ int dlopen_cryptsetup(void) {
         r = dlsym_many_and_warn(
                         dl,
                         LOG_DEBUG,
-                        &sym_crypt_activate_by_passphrase, "crypt_activate_by_passphrase",
+                        DLSYM_ARG(crypt_activate_by_passphrase),
 #if HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY
-                        &sym_crypt_activate_by_signed_key, "crypt_activate_by_signed_key",
+                        DLSYM_ARG(crypt_activate_by_signed_key),
 #endif
-                        &sym_crypt_activate_by_volume_key, "crypt_activate_by_volume_key",
-                        &sym_crypt_deactivate_by_name, "crypt_deactivate_by_name",
-                        &sym_crypt_format, "crypt_format",
-                        &sym_crypt_free, "crypt_free",
-                        &sym_crypt_get_dir, "crypt_get_dir",
-                        &sym_crypt_get_verity_info, "crypt_get_verity_info",
-                        &sym_crypt_init, "crypt_init",
-                        &sym_crypt_init_by_name, "crypt_init_by_name",
-                        &sym_crypt_keyslot_add_by_volume_key, "crypt_keyslot_add_by_volume_key",
-                        &sym_crypt_load, "crypt_load",
-                        &sym_crypt_resize, "crypt_resize",
-                        &sym_crypt_set_data_device, "crypt_set_data_device",
-                        &sym_crypt_set_debug_level, "crypt_set_debug_level",
-                        &sym_crypt_set_log_callback, "crypt_set_log_callback",
-                        &sym_crypt_volume_key_get, "crypt_volume_key_get",
+                        DLSYM_ARG(crypt_activate_by_volume_key),
+                        DLSYM_ARG(crypt_deactivate_by_name),
+                        DLSYM_ARG(crypt_format),
+                        DLSYM_ARG(crypt_free),
+                        DLSYM_ARG(crypt_get_dir),
+                        DLSYM_ARG(crypt_get_verity_info),
+                        DLSYM_ARG(crypt_init),
+                        DLSYM_ARG(crypt_init_by_name),
+                        DLSYM_ARG(crypt_keyslot_add_by_volume_key),
+                        DLSYM_ARG(crypt_load),
+                        DLSYM_ARG(crypt_resize),
+                        DLSYM_ARG(crypt_set_data_device),
+                        DLSYM_ARG(crypt_set_debug_level),
+                        DLSYM_ARG(crypt_set_log_callback),
+                        DLSYM_ARG(crypt_volume_key_get),
                         NULL);
         if (r < 0)
                 return r;
index 83c4b3c530f85eaaff129d95231d536c164aaf11..1c4472dc6694fca6a0b85b27302485e4909af6b0 100644 (file)
@@ -35,9 +35,9 @@ int dlopen_idn(void) {
         r = dlsym_many_and_warn(
                         dl,
                         LOG_DEBUG,
-                        &sym_idn2_lookup_u8, "idn2_lookup_u8",
-                        &sym_idn2_strerror, "idn2_strerror",
-                        &sym_idn2_to_unicode_8z8z, "idn2_to_unicode_8z8z",
+                        DLSYM_ARG(idn2_lookup_u8),
+                        DLSYM_ARG(idn2_strerror),
+                        DLSYM_ARG(idn2_to_unicode_8z8z),
                         NULL);
         if (r < 0)
                 return r;
@@ -76,10 +76,10 @@ int dlopen_idn(void) {
         r = dlsym_many_and_warn(
                         dl,
                         LOG_DEBUG,
-                        &sym_idna_to_ascii_4i, "idna_to_ascii_4i",
-                        &sym_idna_to_unicode_44i, "idna_to_unicode_44i",
-                        &sym_stringprep_ucs4_to_utf8, "stringprep_ucs4_to_utf8",
-                        &sym_stringprep_utf8_to_ucs4, "stringprep_utf8_to_ucs4",
+                        DLSYM_ARG(idna_to_ascii_4i),
+                        DLSYM_ARG(idna_to_unicode_44i),
+                        DLSYM_ARG(stringprep_ucs4_to_utf8),
+                        DLSYM_ARG(stringprep_utf8_to_ucs4),
                         NULL);
         if (r < 0)
                 return r;
index 4000bef89e7a90cfb3755bdf1c193ce034ccfba9..5bd33eee4c44fb705c53b317c711722f79eff2cc 100644 (file)
@@ -38,14 +38,14 @@ int dlopen_pwquality(void) {
         r = dlsym_many_and_warn(
                         dl,
                         LOG_DEBUG,
-                        &sym_pwquality_check, "pwquality_check",
-                        &sym_pwquality_default_settings, "pwquality_default_settings",
-                        &sym_pwquality_free_settings, "pwquality_free_settings",
-                        &sym_pwquality_generate, "pwquality_generate",
-                        &sym_pwquality_get_str_value, "pwquality_get_str_value",
-                        &sym_pwquality_read_config, "pwquality_read_config",
-                        &sym_pwquality_set_int_value, "pwquality_set_int_value",
-                        &sym_pwquality_strerror, "pwquality_strerror",
+                        DLSYM_ARG(pwquality_check),
+                        DLSYM_ARG(pwquality_default_settings),
+                        DLSYM_ARG(pwquality_free_settings),
+                        DLSYM_ARG(pwquality_generate),
+                        DLSYM_ARG(pwquality_get_str_value),
+                        DLSYM_ARG(pwquality_read_config),
+                        DLSYM_ARG(pwquality_set_int_value),
+                        DLSYM_ARG(pwquality_strerror),
                         NULL);
         if (r < 0)
                 return r;
index 7050e186b75aa3e65d64f5498883a3dc58ede0cc..f7d2d984c96510688f02cb33f56c43711f18ad50 100644 (file)
@@ -84,8 +84,8 @@ int print_qrcode(FILE *out, const char *header, const char *string) {
         r = dlsym_many_and_warn(
                         dl,
                         LOG_DEBUG,
-                        &sym_QRcode_encodeString, "QRcode_encodeString",
-                        &sym_QRcode_free, "QRcode_free",
+                        DLSYM_ARG(QRcode_encodeString),
+                        DLSYM_ARG(QRcode_free),
                         NULL);
         if (r < 0)
                 return r;