]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared: Rename pcre2-dlopen.h/c to pcre2-util.h/c
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 6 Jun 2022 14:01:20 +0000 (16:01 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 6 Jun 2022 14:01:20 +0000 (16:01 +0200)
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

src/journal/journalctl.c
src/shared/meson.build
src/shared/pcre2-util.c [moved from src/shared/pcre2-dlopen.c with 98% similarity]
src/shared/pcre2-util.h [moved from src/shared/pcre2-dlopen.h with 81% similarity]
src/test/test-dlopen-so.c

index 046b48184a5d85051360aa027e7e995e53fdb765..904881adc21665eb4bd6c63a26b9f25de23ef633 100644 (file)
@@ -58,7 +58,7 @@
 #include "parse-argument.h"
 #include "parse-util.h"
 #include "path-util.h"
-#include "pcre2-dlopen.h"
+#include "pcre2-util.h"
 #include "pretty-print.h"
 #include "qrcode-util.h"
 #include "random-util.h"
@@ -167,9 +167,6 @@ typedef struct BootId {
 } BootId;
 
 #if HAVE_PCRE2
-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);
-
 static int pattern_compile(const char *pattern, unsigned flags, pcre2_code **out) {
         int errorcode, r;
         PCRE2_SIZE erroroffset;
index 1ddbfac677759ad418e8355c3627d30a1a3eb034..0cd48df1581f9d913d87ed8f0d483e497b5cc729 100644 (file)
@@ -247,8 +247,8 @@ shared_sources = files(
         'parse-argument.h',
         'parse-helpers.c',
         'parse-helpers.h',
-        'pcre2-dlopen.c',
-        'pcre2-dlopen.h',
+        'pcre2-util.c',
+        'pcre2-util.h',
         'pe-header.h',
         'pkcs11-util.c',
         'pkcs11-util.h',
similarity index 98%
rename from src/shared/pcre2-dlopen.c
rename to src/shared/pcre2-util.c
index 475d7eb26da27d6d6ee778191d945b12c54d308f..80f6cec3423694fdcca3c760cb6b587088f4b70b 100644 (file)
@@ -2,7 +2,7 @@
 
 #include "dlfcn-util.h"
 #include "log.h"
-#include "pcre2-dlopen.h"
+#include "pcre2-util.h"
 
 #if HAVE_PCRE2
 static void *pcre2_dl = NULL;
similarity index 81%
rename from src/shared/pcre2-dlopen.h
rename to src/shared/pcre2-util.h
index 130633414474024bac686edb37f61532cddf97c5..f17dcd5573484e9f5d7d473bcd4b7a5879f1c972 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#include "macro.h"
+
 #if HAVE_PCRE2
 
 #define PCRE2_CODE_UNIT_WIDTH 8
@@ -13,6 +15,9 @@ extern pcre2_code* (*sym_pcre2_compile)(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *,
 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);
index 002f666ed85556130833111c9438df851d1afb70..85dbb81e43ca33a7db81c383fea46b18ba08c4e1 100644 (file)
@@ -10,7 +10,7 @@
 #include "libfido2-util.h"
 #include "macro.h"
 #include "main-func.h"
-#include "pcre2-dlopen.h"
+#include "pcre2-util.h"
 #include "pwquality-util.h"
 #include "qrcode-util.h"
 #include "tests.h"