From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Thu, 23 Oct 2025 22:35:42 +0200
Subject: gregex: Handle PCRE2_ERROR_MISSING_NUMBER_TERMINATOR if defined

When the error is defined in a new enough PCRE2 we should handle it.

However let's not define an error message for this in this commit (just
let's use the old one that is generic enough), so that it can be backported
to stable versions without having to require new translations.

Origin: upstream, 2.86.2, commit:9f47e1c16f1b5f89815a7bd6f66835e2a19db11f
Bug: https://gitlab.gnome.org/GNOME/glib/-/issues/3809
Bug-Debian: https://bugs.debian.org/1118572
---
 glib/gregex.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/glib/gregex.c b/glib/gregex.c
index 969c702..fac3f58 100644
--- a/glib/gregex.c
+++ b/glib/gregex.c
@@ -770,6 +770,9 @@ translate_compile_error (gint *errcode, const gchar **errmsg)
       *errmsg = _("inconsistent NEWLINE options");
       break;
     case PCRE2_ERROR_BACKSLASH_G_SYNTAX:
+#ifdef PCRE2_ERROR_MISSING_NUMBER_TERMINATOR
+    case PCRE2_ERROR_MISSING_NUMBER_TERMINATOR:
+#endif
       *errcode = G_REGEX_ERROR_MISSING_BACK_REFERENCE;
       *errmsg = _("\\g is not followed by a braced, angle-bracketed, or quoted name or "
                   "number, or by a plain number");
