From 60e9d54a7c5a61b959d3461268da63d93ab41ef1 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 31 Dec 2022 00:10:24 +0200 Subject: [PATCH] mu-regex: make backward-compatible with older glib --- lib/utils/mu-regex.hh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/utils/mu-regex.hh b/lib/utils/mu-regex.hh index 5a93b195..e36e8891 100644 --- a/lib/utils/mu-regex.hh +++ b/lib/utils/mu-regex.hh @@ -28,6 +28,10 @@ namespace Mu { * PCRE rather than std::regex because it is much faster. */ struct Regex { +#if !GLIB_CHECK_VERSION(2,74,0) /* backward compat */ +#define G_REGEX_DEFAULT (static_cast(0)) +#define G_REGEX_MATCH_DEFAULT (static_cast(0)) +#endif /** * Trivial constructor * @@ -35,7 +39,6 @@ struct Regex { */ Regex() noexcept: rx_{} {} - /** * Construct a new Regex object * @@ -47,7 +50,7 @@ struct Regex { */ static Result make(const std::string& ptrn, GRegexCompileFlags cflags = G_REGEX_DEFAULT, - GRegexMatchFlags mflags = G_REGEX_MATCH_DEFAULT) noexcept try { + GRegexMatchFlags mflags = G_REGEX_MATCH_DEFAULT) noexcept try { return Regex(ptrn.c_str(), cflags, mflags); } catch (const Error& err) { return Err(err);