summaryrefslogtreecommitdiffstats
path: root/src/locale
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-03-01 10:12:48 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2024-03-01 16:51:24 +0100
commit9dbabd0a8b4dda28fd2c6dae0f75e763f26e8e05 (patch)
tree27408fe3c3b238304d0a376840022f37d3c7c9e8 /src/locale
parentuki: Support zboot efistub kernel (diff)
downloadsystemd-9dbabd0a8b4dda28fd2c6dae0f75e763f26e8e05.tar.xz
systemd-9dbabd0a8b4dda28fd2c6dae0f75e763f26e8e05.zip
tree-wide: switch dlopen hooks over to DLSYM_PROTOTYPE()/DLSYM_FUNCTION()
We have these pretty macros, let's use them everywhere (so far we mostly used them for newer additions only). This PR is mostly an excercise in "perl -p -i -e", but there are some special cases: * idn-util.c exposes a function whose prototype in the official library headers is marked with the "const" attribute, and this apparently does not propagate along typeof() correctly and then __builtin_types_compatible_p() fails later because it detects that prototype and original function don't match in prototype. * libbpf removed some symbols in newer versions, hence we need to define some prototypes manually to still be able to build. * libcryptsetup marked a symbol as deprecated we want to use (knowing it is deprecated). By using the macros this is detected by the compiler. We work around it via the usual warning off macros. Note by using these macros we assume that all symbols are known during build time. Which might not be the case. We might need to revert this commit for some symbols if this trips up builds on older distros.
Diffstat (limited to 'src/locale')
-rw-r--r--src/locale/xkbcommon-util.c19
-rw-r--r--src/locale/xkbcommon-util.h21
2 files changed, 12 insertions, 28 deletions
diff --git a/src/locale/xkbcommon-util.c b/src/locale/xkbcommon-util.c
index 295ac8af8d..468452f8af 100644
--- a/src/locale/xkbcommon-util.c
+++ b/src/locale/xkbcommon-util.c
@@ -9,20 +9,11 @@
#if HAVE_XKBCOMMON
static void *xkbcommon_dl = NULL;
-struct xkb_context* (*sym_xkb_context_new)(enum xkb_context_flags flags);
-void (*sym_xkb_context_unref)(struct xkb_context *context);
-void (*sym_xkb_context_set_log_fn)(
- struct xkb_context *context,
- void (*log_fn)(
- struct xkb_context *context,
- enum xkb_log_level level,
- const char *format,
- va_list args));
-struct xkb_keymap* (*sym_xkb_keymap_new_from_names)(
- struct xkb_context *context,
- const struct xkb_rule_names *names,
- enum xkb_keymap_compile_flags flags);
-void (*sym_xkb_keymap_unref)(struct xkb_keymap *keymap);
+DLSYM_FUNCTION(xkb_context_new);
+DLSYM_FUNCTION(xkb_context_unref);
+DLSYM_FUNCTION(xkb_context_set_log_fn);
+DLSYM_FUNCTION(xkb_keymap_new_from_names);
+DLSYM_FUNCTION(xkb_keymap_unref);
static int dlopen_xkbcommon(void) {
return dlopen_many_sym_or_warn(
diff --git a/src/locale/xkbcommon-util.h b/src/locale/xkbcommon-util.h
index e99c2d7783..92f45c2bcb 100644
--- a/src/locale/xkbcommon-util.h
+++ b/src/locale/xkbcommon-util.h
@@ -1,23 +1,16 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#include "dlfcn-util.h"
+
#if HAVE_XKBCOMMON
#include <xkbcommon/xkbcommon.h>
-extern struct xkb_context* (*sym_xkb_context_new)(enum xkb_context_flags flags);
-extern void (*sym_xkb_context_unref)(struct xkb_context *context);
-extern void (*sym_xkb_context_set_log_fn)(
- struct xkb_context *context,
- void (*log_fn)(
- struct xkb_context *context,
- enum xkb_log_level level,
- const char *format,
- va_list args));
-extern struct xkb_keymap* (*sym_xkb_keymap_new_from_names)(
- struct xkb_context *context,
- const struct xkb_rule_names *names,
- enum xkb_keymap_compile_flags flags);
-extern void (*sym_xkb_keymap_unref)(struct xkb_keymap *keymap);
+DLSYM_PROTOTYPE(xkb_context_new);
+DLSYM_PROTOTYPE(xkb_context_unref);
+DLSYM_PROTOTYPE(xkb_context_set_log_fn);
+DLSYM_PROTOTYPE(xkb_keymap_new_from_names);
+DLSYM_PROTOTYPE(xkb_keymap_unref);
int verify_xkb_rmlvo(const char *model, const char *layout, const char *variant, const char *options);