]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/pcre2-util.h
core: Record ExecMainStartTimestamp before forking
[thirdparty/systemd.git] / src / shared / pcre2-util.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "hash-funcs.h"
5 #include "macro.h"
6
7 #if HAVE_PCRE2
8
9 #include "dlfcn-util.h"
10
11 #define PCRE2_CODE_UNIT_WIDTH 8
12 #include <pcre2.h>
13
14 DLSYM_PROTOTYPE(pcre2_match_data_create);
15 DLSYM_PROTOTYPE(pcre2_match_data_free);
16 DLSYM_PROTOTYPE(pcre2_code_free);
17 DLSYM_PROTOTYPE(pcre2_compile);
18 DLSYM_PROTOTYPE(pcre2_get_error_message);
19 DLSYM_PROTOTYPE(pcre2_match);
20 DLSYM_PROTOTYPE(pcre2_get_ovector_pointer);
21
22 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(pcre2_match_data*, sym_pcre2_match_data_free, NULL);
23 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(pcre2_code*, sym_pcre2_code_free, NULL);
24 #else
25
26 typedef struct {} pcre2_code;
27
28 #endif
29
30 extern const struct hash_ops pcre2_code_hash_ops_free;
31
32 typedef enum {
33 PATTERN_COMPILE_CASE_AUTO,
34 PATTERN_COMPILE_CASE_SENSITIVE,
35 PATTERN_COMPILE_CASE_INSENSITIVE,
36 _PATTERN_COMPILE_CASE_MAX,
37 _PATTERN_COMPILE_CASE_INVALID = -EINVAL,
38 } PatternCompileCase;
39
40 int pattern_compile_and_log(const char *pattern, PatternCompileCase case_, pcre2_code **ret);
41 int pattern_matches_and_log(pcre2_code *compiled_pattern, const char *message, size_t size, size_t *ret_ovec);
42 void *pattern_free(pcre2_code *p);
43
44 DEFINE_TRIVIAL_CLEANUP_FUNC(pcre2_code*, pattern_free);
45
46 int dlopen_pcre2(void);