aboutsummaryrefslogtreecommitdiffstats
path: root/community/phosh/0003-util-Don-t-use-G_REGEX_JAVASCRIPT_COMPAT.patch
blob: b028874dc6fe7e74d7708ae00d22c1bf7026c009 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 9375f72b2e22a588c7dc39dfef8fe9b46d936d03 Mon Sep 17 00:00:00 2001
From: Fiona Klute <fiona.klute@gmx.de>
Date: Mon, 19 Sep 2022 21:18:37 +0200
Subject: [PATCH 3/3] util: Don't use G_REGEX_JAVASCRIPT_COMPAT

G_REGEX_JAVASCRIPT_COMPAT is unsupported as of glib 2.74 and
not needed for the regex at hand.

G_REGEX_DEFAULT is the preferable default but not available before
glib 2.73.2, so there's a fallback to 0 for earlier versions.

Closes: https://gitlab.gnome.org/World/Phosh/phosh/-/issues/840
Part-of: <https://gitlab.gnome.org/World/Phosh/phosh/-/merge_requests/1148>
---
 src/util.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/util.c b/src/util.c
index 746e5e70..f2a55e5c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -19,6 +19,11 @@
 #include <fcntl.h>
 
 
+#if !GLIB_CHECK_VERSION(2, 73, 2)
+#define G_REGEX_DEFAULT 0
+#endif
+
+
 static gboolean have_gnome_software = -1;
 
 
@@ -401,7 +406,7 @@ phosh_util_escape_markup (const char *markup, gboolean allow_markup)
     /* Escape &whatever; */
     /* Support &amp;, &quot;, &apos;, &lt; and &gt;, escape all other occurrences of '&'. */
     amp_re = g_regex_new ("&(?!amp;|quot;|apos;|lt;|gt;)",
-                          G_REGEX_JAVASCRIPT_COMPAT,
+                          G_REGEX_DEFAULT,
                           0,
                           &err);
     if (!amp_re) {
@@ -426,7 +431,7 @@ phosh_util_escape_markup (const char *markup, gboolean allow_markup)
      * https://specifications.freedesktop.org/notification-spec/latest/ar01s04.html
      */
     elem_re = g_regex_new ("<(?!/?[biu]>)",
-                           G_REGEX_JAVASCRIPT_COMPAT,
+                           G_REGEX_DEFAULT,
                            0,
                            &err);
     if (!elem_re) {
-- 
2.37.2