summaryrefslogtreecommitdiffstats
path: root/src/shared/pcre2-util.h
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-06-06 16:01:20 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-06-06 16:01:20 +0200
commite30c1d01b64c9c313b333d0c1051cf39b3b30d91 (patch)
treed6ea369e82073e2a830e8857b86962b6e7a52922 /src/shared/pcre2-util.h
parentmeson: Switch default-locale default to C.UTF-8 (diff)
downloadsystemd-e30c1d01b64c9c313b333d0c1051cf39b3b30d91.tar.xz
systemd-e30c1d01b64c9c313b333d0c1051cf39b3b30d91.zip
shared: Rename pcre2-dlopen.h/c to pcre2-util.h/c
We already store the dlopen() stuff for other libraries in util headers as well so let's do the same for pcre2. We also move the definition of some trivial cleanup functions from journalctl.c to pcre2-util.h
Diffstat (limited to 'src/shared/pcre2-util.h')
-rw-r--r--src/shared/pcre2-util.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/shared/pcre2-util.h b/src/shared/pcre2-util.h
new file mode 100644
index 0000000000..f17dcd5573
--- /dev/null
+++ b/src/shared/pcre2-util.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "macro.h"
+
+#if HAVE_PCRE2
+
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+
+extern pcre2_match_data* (*sym_pcre2_match_data_create)(uint32_t, pcre2_general_context *);
+extern void (*sym_pcre2_match_data_free)(pcre2_match_data *);
+extern void (*sym_pcre2_code_free)(pcre2_code *);
+extern pcre2_code* (*sym_pcre2_compile)(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, pcre2_compile_context *);
+extern int (*sym_pcre2_get_error_message)(int, PCRE2_UCHAR *, PCRE2_SIZE);
+extern int (*sym_pcre2_match)(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, pcre2_match_data *, pcre2_match_context *);
+extern PCRE2_SIZE* (*sym_pcre2_get_ovector_pointer)(pcre2_match_data *);
+
+DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(pcre2_match_data*, sym_pcre2_match_data_free, NULL);
+DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(pcre2_code*, sym_pcre2_code_free, NULL);
+#endif
+
+int dlopen_pcre2(void);