]> git.ipfire.org Git - thirdparty/systemd.git/commit
journal: Move more pattern matching logic into pcre2-util
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 22 Jul 2022 12:49:42 +0000 (14:49 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 25 Jul 2022 12:16:17 +0000 (14:16 +0200)
commit75db32dcd810cb6f4bc0148c3e280c5c04203491
treed200b732eeae976392e8c64ac87782ecaa0f022e
parent05abe850330fdef145d8d45d5a2e33d76a0a8d21
journal: Move more pattern matching logic into pcre2-util

To avoid having "#if HAVE_PCRE2" all throughout the code, let's
confine the pcre2 header specific stuff to pcre2-util.c. Instead of
exposing all the individual symbols from pcre2, let's only expose
three high level functions that do all we need:

- pcre2_pattern_compile(): Compile the regex
- pcre2_pattern_matches(): Check if the compiled regex matches a message
- pcre2_pattern_free(): Free the compiled regex

We expose the compiled pcre2 pattern (which is of type pcre2_code *) as
a void pointer to avoid having to include pcre2.h in all code where we
work with compiled pcre2 patterns. For readability, we typedef void
to pcre2_pattern and use that as the type specifier for compiled pcre2
patterns.
src/journal/journalctl.c
src/shared/pcre2-util.c
src/shared/pcre2-util.h