• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 879b9cd669f03ecd69f0c6913f06275d9c1973c6 Mon Sep 17 00:00:00 2001
2From: Simon McVittie <smcv@collabora.com>
3Date: Thu, 23 Jun 2022 10:34:15 +0100
4Subject: [PATCH] gregex: Add G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT
5
6Signed-off-by: Simon McVittie <smcv@collabora.com>
7
8Conflict:NA
9Reference:https://gitlab.gnome.org/GNOME/glib/-/commit/879b9cd669f03ecd69f0c6913f06275d9c1973c6
10
11---
12 gio/gsettingsschema.c |  12 ++--
13 glib/gregex.c         |   8 +--
14 glib/gregex.h         |   4 ++
15 glib/tests/autoptr.c  |   6 +-
16 glib/tests/regex.c    | 143 +++++++++++++++++++++---------------------
17 gobject/tests/boxed.c |   4 +-
18 6 files changed, 94 insertions(+), 83 deletions(-)
19
20diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
21index 6ac1dfffa0..fb3bb70122 100644
22--- a/gio/gsettingsschema.c
23+++ b/gio/gsettingsschema.c
24@@ -579,10 +579,14 @@ normalise_whitespace (const gchar *orig)
25     {
26       GRegex *s;
27
28-      cleanup[0] = g_regex_new ("^\\s+", 0, 0, 0);
29-      cleanup[1] = g_regex_new ("\\s+$", 0, 0, 0);
30-      cleanup[2] = g_regex_new ("\\s+", 0, 0, 0);
31-      s = g_regex_new ("\\n\\s*\\n+", 0, 0, 0);
32+      cleanup[0] = g_regex_new ("^\\s+", G_REGEX_DEFAULT,
33+                                G_REGEX_MATCH_DEFAULT, NULL);
34+      cleanup[1] = g_regex_new ("\\s+$", G_REGEX_DEFAULT,
35+                                G_REGEX_MATCH_DEFAULT, NULL);
36+      cleanup[2] = g_regex_new ("\\s+", G_REGEX_DEFAULT,
37+                                G_REGEX_MATCH_DEFAULT, NULL);
38+      s = g_regex_new ("\\n\\s*\\n+", G_REGEX_DEFAULT,
39+                       G_REGEX_MATCH_DEFAULT, NULL);
40
41       g_once_init_leave (&splitter, s);
42     }
43diff --git a/glib/gregex.c b/glib/gregex.c
44index 2fa0698911..5254d8d282 100644
45--- a/glib/gregex.c
46+++ b/glib/gregex.c
47@@ -1653,7 +1653,7 @@ g_regex_match_simple (const gchar        *pattern,
48   GRegex *regex;
49   gboolean result;
50
51-  regex = g_regex_new (pattern, compile_options, 0, NULL);
52+  regex = g_regex_new (pattern, compile_options, G_REGEX_MATCH_DEFAULT, NULL);
53   if (!regex)
54     return FALSE;
55   result = g_regex_match_full (regex, string, -1, 0, match_options, NULL, NULL);
56@@ -1692,7 +1692,7 @@ g_regex_match_simple (const gchar        *pattern,
57  *   GRegex *regex;
58  *   GMatchInfo *match_info;
59  *
60- *   regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
61+ *   regex = g_regex_new ("[A-Z]+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
62  *   g_regex_match (regex, string, 0, &match_info);
63  *   while (g_match_info_matches (match_info))
64  *     {
65@@ -1768,7 +1768,7 @@ g_regex_match (const GRegex      *regex,
66  *   GMatchInfo *match_info;
67  *   GError *error = NULL;
68  *
69- *   regex = g_regex_new ("[A-Z]+", 0, 0, NULL);
70+ *   regex = g_regex_new ("[A-Z]+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
71  *   g_regex_match_full (regex, string, -1, 0, 0, &match_info, &error);
72  *   while (g_match_info_matches (match_info))
73  *     {
74@@ -2949,7 +2949,7 @@ g_regex_replace_literal (const GRegex      *regex,
75  * g_hash_table_insert (h, "3", "THREE");
76  * g_hash_table_insert (h, "4", "FOUR");
77  *
78- * reg = g_regex_new ("1|2|3|4", 0, 0, NULL);
79+ * reg = g_regex_new ("1|2|3|4", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
80  * res = g_regex_replace_eval (reg, text, -1, 0, 0, eval_cb, h, NULL);
81  * g_hash_table_destroy (h);
82  *
83diff --git a/glib/gregex.h b/glib/gregex.h
84index 89c8485471..3fd61806f7 100644
85--- a/glib/gregex.h
86+++ b/glib/gregex.h
87@@ -218,6 +218,7 @@ GQuark g_regex_error_quark (void);
88
89 /**
90  * GRegexCompileFlags:
91+ * @G_REGEX_DEFAULT: No special options set. Since: 2.74
92  * @G_REGEX_CASELESS: Letters in the pattern match both upper- and
93  *     lowercase letters. This option can be changed within a pattern
94  *     by a "(?i)" option setting.
95@@ -297,6 +298,7 @@ GQuark g_regex_error_quark (void);
96  */
97 typedef enum
98 {
99+  G_REGEX_DEFAULT GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
100   G_REGEX_CASELESS          = 1 << 0,
101   G_REGEX_MULTILINE         = 1 << 1,
102   G_REGEX_DOTALL            = 1 << 2,
103@@ -319,6 +321,7 @@ typedef enum
104
105 /**
106  * GRegexMatchFlags:
107+ * @G_REGEX_MATCH_DEFAULT: No special options set. Since: 2.74
108  * @G_REGEX_MATCH_ANCHORED: The pattern is forced to be "anchored", that is,
109  *     it is constrained to match only at the first matching point in the
110  *     string that is being searched. This effect can also be achieved by
111@@ -387,6 +390,7 @@ typedef enum
112  * adding a new flag. */
113 typedef enum
114 {
115+  G_REGEX_MATCH_DEFAULT GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
116   G_REGEX_MATCH_ANCHORED         = 1 << 4,
117   G_REGEX_MATCH_NOTBOL           = 1 << 7,
118   G_REGEX_MATCH_NOTEOL           = 1 << 8,
119diff --git a/glib/tests/autoptr.c b/glib/tests/autoptr.c
120index 035d3f6133..c5d9877bbe 100644
121--- a/glib/tests/autoptr.c
122+++ b/glib/tests/autoptr.c
123@@ -296,14 +296,16 @@ test_g_rand (void)
124 static void
125 test_g_regex (void)
126 {
127-  g_autoptr(GRegex) val = g_regex_new (".*", 0, 0, NULL);
128+  g_autoptr(GRegex) val = g_regex_new (".*", G_REGEX_DEFAULT,
129+                                       G_REGEX_MATCH_DEFAULT, NULL);
130   g_assert_nonnull (val);
131 }
132
133 static void
134 test_g_match_info (void)
135 {
136-  g_autoptr(GRegex) regex = g_regex_new (".*", 0, 0, NULL);
137+  g_autoptr(GRegex) regex = g_regex_new (".*", G_REGEX_DEFAULT,
138+                                         G_REGEX_MATCH_DEFAULT, NULL);
139   g_autoptr(GMatchInfo) match = NULL;
140
141   if (!g_regex_match (regex, "hello", 0, &match))
142diff --git a/glib/tests/regex.c b/glib/tests/regex.c
143index e19f975875..c39d640fa2 100644
144--- a/glib/tests/regex.c
145+++ b/glib/tests/regex.c
146@@ -286,7 +286,7 @@ test_match_next (gconstpointer d)
147   GSList *matches;
148   GSList *l_exp, *l_match;
149
150-  regex = g_regex_new (data->pattern, 0, 0, NULL);
151+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
152
153   g_assert (regex != NULL);
154
155@@ -478,7 +478,7 @@ test_match_count (gconstpointer d)
156   GMatchInfo *match_info;
157   gint count;
158
159-  regex = g_regex_new (data->pattern, 0, 0, NULL);
160+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
161
162   g_assert (regex != NULL);
163
164@@ -515,7 +515,7 @@ test_partial (gconstpointer d)
165   GRegex *regex;
166   GMatchInfo *match_info;
167
168-  regex = g_regex_new (data->pattern, 0, 0, NULL);
169+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
170
171   g_assert (regex != NULL);
172
173@@ -567,7 +567,7 @@ test_sub_pattern (gconstpointer d)
174   gchar *sub_expr;
175   gint start = UNTOUCHED, end = UNTOUCHED;
176
177-  regex = g_regex_new (data->pattern, 0, 0, NULL);
178+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
179
180   g_assert (regex != NULL);
181
182@@ -622,7 +622,7 @@ test_named_sub_pattern (gconstpointer d)
183   gint start = UNTOUCHED, end = UNTOUCHED;
184   gchar *sub_expr;
185
186-  regex = g_regex_new (data->pattern, data->flags, 0, NULL);
187+  regex = g_regex_new (data->pattern, data->flags, G_REGEX_MATCH_DEFAULT, NULL);
188
189   g_assert (regex != NULL);
190
191@@ -694,7 +694,7 @@ test_fetch_all (gconstpointer d)
192   gint match_count;
193   gint i;
194
195-  regex = g_regex_new (data->pattern, 0, 0, NULL);
196+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
197
198   g_assert (regex != NULL);
199
200@@ -788,7 +788,8 @@ test_split_simple (gconstpointer d)
201   gint token_count;
202   gint i;
203
204-  tokens = g_regex_split_simple (data->pattern, data->string, 0, 0);
205+  tokens = g_regex_split_simple (data->pattern, data->string,
206+                                 G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
207   if (tokens)
208     token_count = g_strv_length (tokens);
209   else
210@@ -867,7 +868,7 @@ test_split_full (gconstpointer d)
211   gint token_count;
212   gint i;
213
214-  regex = g_regex_new (data->pattern, 0, 0, NULL);
215+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
216
217   g_assert (regex != NULL);
218
219@@ -901,7 +902,7 @@ test_split (gconstpointer d)
220   gint token_count;
221   gint i;
222
223-  regex = g_regex_new (data->pattern, 0, 0, NULL);
224+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
225
226   g_assert (regex != NULL);
227
228@@ -1057,8 +1058,8 @@ test_expand (gconstpointer d)
229
230   if (data->pattern)
231     {
232-      regex = g_regex_new (data->pattern, data->raw ? G_REGEX_RAW : 0, 0,
233-          &error);
234+      regex = g_regex_new (data->pattern, data->raw ? G_REGEX_RAW : 0,
235+                           G_REGEX_MATCH_DEFAULT, &error);
236       g_assert_no_error (error);
237       g_regex_match (regex, data->string, 0, &match_info);
238     }
239@@ -1100,7 +1101,7 @@ test_replace (gconstpointer d)
240   GRegex *regex;
241   gchar *res;
242
243-  regex = g_regex_new (data->pattern, 0, 0, NULL);
244+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
245   res = g_regex_replace (regex, data->string, -1, data->start_position, data->replacement, 0, NULL);
246
247   g_assert_cmpstr (res, ==, data->expected);
248@@ -1130,7 +1131,7 @@ test_replace_lit (gconstpointer d)
249   GRegex *regex;
250   gchar *res;
251
252-  regex = g_regex_new (data->pattern, 0, 0, NULL);
253+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
254   res = g_regex_replace_literal (regex, data->string, -1, data->start_position,
255                                  data->replacement, 0, NULL);
256   g_assert_cmpstr (res, ==, data->expected);
257@@ -1166,7 +1167,7 @@ test_get_string_number (gconstpointer d)
258   GRegex *regex;
259   gint num;
260
261-  regex = g_regex_new (data->pattern, 0, 0, NULL);
262+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
263   num = g_regex_get_string_number (regex, data->name);
264
265   g_assert_cmpint (num, ==, data->expected_num);
266@@ -1260,7 +1261,7 @@ test_match_all_full (gconstpointer d)
267   gint match_count;
268   gint i;
269
270-  regex = g_regex_new (data->pattern, 0, 0, NULL);
271+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
272   match_ok = g_regex_match_all_full (regex, data->string, data->string_len, data->start_position,
273                                      0, &match_info, NULL);
274
275@@ -1305,7 +1306,7 @@ test_match_all (gconstpointer d)
276   gboolean match_ok;
277   guint i, match_count;
278
279-  regex = g_regex_new (data->pattern, 0, 0, NULL);
280+  regex = g_regex_new (data->pattern, G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
281   match_ok = g_regex_match_all (regex, data->string, 0, &match_info);
282
283   if (g_slist_length (data->expected) == 0)
284@@ -1502,7 +1503,7 @@ test_properties (void)
285   gchar *str;
286
287   error = NULL;
288-  regex = g_regex_new ("\\p{L}\\p{Ll}\\p{Lu}\\p{L&}\\p{N}\\p{Nd}", G_REGEX_OPTIMIZE, 0, &error);
289+  regex = g_regex_new ("\\p{L}\\p{Ll}\\p{Lu}\\p{L&}\\p{N}\\p{Nd}", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
290   res = g_regex_match (regex, "ppPP01", 0, &match);
291   g_assert (res);
292   str = g_match_info_fetch (match, 0);
293@@ -1523,7 +1524,7 @@ test_class (void)
294   gchar *str;
295
296   error = NULL;
297-  regex = g_regex_new ("[abc\\x{0B1E}\\p{Mn}\\x{0391}-\\x{03A9}]", G_REGEX_OPTIMIZE, 0, &error);
298+  regex = g_regex_new ("[abc\\x{0B1E}\\p{Mn}\\x{0391}-\\x{03A9}]", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
299   res = g_regex_match (regex, "a:b:\340\254\236:\333\253:\316\240", 0, &match);
300   g_assert (res);
301   str = g_match_info_fetch (match, 0);
302@@ -1569,7 +1570,7 @@ test_lookahead (void)
303   gint start, end;
304
305   error = NULL;
306-  regex = g_regex_new ("\\w+(?=;)", G_REGEX_OPTIMIZE, 0, &error);
307+  regex = g_regex_new ("\\w+(?=;)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
308   g_assert (regex);
309   g_assert_no_error (error);
310   res = g_regex_match (regex, "word1 word2: word3;", 0, &match);
311@@ -1583,7 +1584,7 @@ test_lookahead (void)
312   g_regex_unref (regex);
313
314   error = NULL;
315-  regex = g_regex_new ("foo(?!bar)", G_REGEX_OPTIMIZE, 0, &error);
316+  regex = g_regex_new ("foo(?!bar)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
317   g_assert (regex);
318   g_assert_no_error (error);
319   res = g_regex_match (regex, "foobar foobaz", 0, &match);
320@@ -1598,7 +1599,7 @@ test_lookahead (void)
321   g_regex_unref (regex);
322
323   error = NULL;
324-  regex = g_regex_new ("(?!bar)foo", G_REGEX_OPTIMIZE, 0, &error);
325+  regex = g_regex_new ("(?!bar)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
326   g_assert (regex);
327   g_assert_no_error (error);
328   res = g_regex_match (regex, "foobar foobaz", 0, &match);
329@@ -1631,7 +1632,7 @@ test_lookbehind (void)
330   gint start, end;
331
332   error = NULL;
333-  regex = g_regex_new ("(?<!foo)bar", G_REGEX_OPTIMIZE, 0, &error);
334+  regex = g_regex_new ("(?<!foo)bar", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
335   g_assert (regex);
336   g_assert_no_error (error);
337   res = g_regex_match (regex, "foobar boobar", 0, &match);
338@@ -1646,7 +1647,7 @@ test_lookbehind (void)
339   g_regex_unref (regex);
340
341   error = NULL;
342-  regex = g_regex_new ("(?<=bullock|donkey) poo", G_REGEX_OPTIMIZE, 0, &error);
343+  regex = g_regex_new ("(?<=bullock|donkey) poo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
344   g_assert (regex);
345   g_assert_no_error (error);
346   res = g_regex_match (regex, "don poo, and bullock poo", 0, &match);
347@@ -1659,17 +1660,17 @@ test_lookbehind (void)
348   g_match_info_free (match);
349   g_regex_unref (regex);
350
351-  regex = g_regex_new ("(?<!dogs?|cats?) x", G_REGEX_OPTIMIZE, 0, &error);
352+  regex = g_regex_new ("(?<!dogs?|cats?) x", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
353   g_assert (regex == NULL);
354   g_assert_error (error, G_REGEX_ERROR, G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND);
355   g_clear_error (&error);
356
357-  regex = g_regex_new ("(?<=ab(c|de)) foo", G_REGEX_OPTIMIZE, 0, &error);
358+  regex = g_regex_new ("(?<=ab(c|de)) foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
359   g_assert (regex == NULL);
360   g_assert_error (error, G_REGEX_ERROR, G_REGEX_ERROR_VARIABLE_LENGTH_LOOKBEHIND);
361   g_clear_error (&error);
362
363-  regex = g_regex_new ("(?<=abc|abde)foo", G_REGEX_OPTIMIZE, 0, &error);
364+  regex = g_regex_new ("(?<=abc|abde)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
365   g_assert (regex);
366   g_assert_no_error (error);
367   res = g_regex_match (regex, "abfoo, abdfoo, abcfoo", 0, &match);
368@@ -1681,7 +1682,7 @@ test_lookbehind (void)
369   g_match_info_free (match);
370   g_regex_unref (regex);
371
372-  regex = g_regex_new ("^.*+(?<=abcd)", G_REGEX_OPTIMIZE, 0, &error);
373+  regex = g_regex_new ("^.*+(?<=abcd)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
374   g_assert (regex);
375   g_assert_no_error (error);
376   res = g_regex_match (regex, "abcabcabcabcabcabcabcabcabcd", 0, &match);
377@@ -1690,7 +1691,7 @@ test_lookbehind (void)
378   g_match_info_free (match);
379   g_regex_unref (regex);
380
381-  regex = g_regex_new ("(?<=\\d{3})(?<!999)foo", G_REGEX_OPTIMIZE, 0, &error);
382+  regex = g_regex_new ("(?<=\\d{3})(?<!999)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
383   g_assert (regex);
384   g_assert_no_error (error);
385   res = g_regex_match (regex, "999foo 123abcfoo 123foo", 0, &match);
386@@ -1702,7 +1703,7 @@ test_lookbehind (void)
387   g_match_info_free (match);
388   g_regex_unref (regex);
389
390-  regex = g_regex_new ("(?<=\\d{3}...)(?<!999)foo", G_REGEX_OPTIMIZE, 0, &error);
391+  regex = g_regex_new ("(?<=\\d{3}...)(?<!999)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
392   g_assert (regex);
393   g_assert_no_error (error);
394   res = g_regex_match (regex, "999foo 123abcfoo 123foo", 0, &match);
395@@ -1714,7 +1715,7 @@ test_lookbehind (void)
396   g_match_info_free (match);
397   g_regex_unref (regex);
398
399-  regex = g_regex_new ("(?<=\\d{3}(?!999)...)foo", G_REGEX_OPTIMIZE, 0, &error);
400+  regex = g_regex_new ("(?<=\\d{3}(?!999)...)foo", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
401   g_assert (regex);
402   g_assert_no_error (error);
403   res = g_regex_match (regex, "999foo 123abcfoo 123foo", 0, &match);
404@@ -1726,7 +1727,7 @@ test_lookbehind (void)
405   g_match_info_free (match);
406   g_regex_unref (regex);
407
408-  regex = g_regex_new ("(?<=(?<!foo)bar)baz", G_REGEX_OPTIMIZE, 0, &error);
409+  regex = g_regex_new ("(?<=(?<!foo)bar)baz", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
410   g_assert (regex);
411   g_assert_no_error (error);
412   res = g_regex_match (regex, "foobarbaz barfoobaz barbarbaz", 0, &match);
413@@ -1751,7 +1752,7 @@ test_subpattern (void)
414   gint start;
415
416   error = NULL;
417-  regex = g_regex_new ("cat(aract|erpillar|)", G_REGEX_OPTIMIZE, 0, &error);
418+  regex = g_regex_new ("cat(aract|erpillar|)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
419   g_assert (regex);
420   g_assert_no_error (error);
421   g_assert_cmpint (g_regex_get_capture_count (regex), ==, 1);
422@@ -1769,7 +1770,7 @@ test_subpattern (void)
423   g_match_info_free (match);
424   g_regex_unref (regex);
425
426-  regex = g_regex_new ("the ((red|white) (king|queen))", G_REGEX_OPTIMIZE, 0, &error);
427+  regex = g_regex_new ("the ((red|white) (king|queen))", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
428   g_assert (regex);
429   g_assert_no_error (error);
430   g_assert_cmpint (g_regex_get_capture_count (regex), ==, 3);
431@@ -1793,7 +1794,7 @@ test_subpattern (void)
432   g_match_info_free (match);
433   g_regex_unref (regex);
434
435-  regex = g_regex_new ("the ((?:red|white) (king|queen))", G_REGEX_OPTIMIZE, 0, &error);
436+  regex = g_regex_new ("the ((?:red|white) (king|queen))", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
437   g_assert (regex);
438   g_assert_no_error (error);
439   res = g_regex_match (regex, "the white queen", 0, &match);
440@@ -1813,7 +1814,7 @@ test_subpattern (void)
441   g_match_info_free (match);
442   g_regex_unref (regex);
443
444-  regex = g_regex_new ("(?|(Sat)(ur)|(Sun))day (morning|afternoon)", G_REGEX_OPTIMIZE, 0, &error);
445+  regex = g_regex_new ("(?|(Sat)(ur)|(Sun))day (morning|afternoon)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
446   g_assert (regex);
447   g_assert_no_error (error);
448   g_assert_cmpint (g_regex_get_capture_count (regex), ==, 3);
449@@ -1833,7 +1834,7 @@ test_subpattern (void)
450   g_match_info_free (match);
451   g_regex_unref (regex);
452
453-  regex = g_regex_new ("(?|(abc)|(def))\\1", G_REGEX_OPTIMIZE, 0, &error);
454+  regex = g_regex_new ("(?|(abc)|(def))\\1", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
455   g_assert (regex);
456   g_assert_no_error (error);
457   g_assert_cmpint (g_regex_get_max_backref (regex), ==, 1);
458@@ -1851,7 +1852,7 @@ test_subpattern (void)
459   g_match_info_free (match);
460   g_regex_unref (regex);
461
462-  regex = g_regex_new ("(?|(abc)|(def))(?1)", G_REGEX_OPTIMIZE, 0, &error);
463+  regex = g_regex_new ("(?|(abc)|(def))(?1)", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
464   g_assert (regex);
465   g_assert_no_error (error);
466   res = g_regex_match (regex, "abcabc abcdef defabc defdef", 0, &match);
467@@ -1868,7 +1869,7 @@ test_subpattern (void)
468   g_match_info_free (match);
469   g_regex_unref (regex);
470
471-  regex = g_regex_new ("(?<DN>Mon|Fri|Sun)(?:day)?|(?<DN>Tue)(?:sday)?|(?<DN>Wed)(?:nesday)?|(?<DN>Thu)(?:rsday)?|(?<DN>Sat)(?:urday)?", G_REGEX_OPTIMIZE|G_REGEX_DUPNAMES, 0, &error);
472+  regex = g_regex_new ("(?<DN>Mon|Fri|Sun)(?:day)?|(?<DN>Tue)(?:sday)?|(?<DN>Wed)(?:nesday)?|(?<DN>Thu)(?:rsday)?|(?<DN>Sat)(?:urday)?", G_REGEX_OPTIMIZE|G_REGEX_DUPNAMES, G_REGEX_MATCH_DEFAULT, &error);
473   g_assert (regex);
474   g_assert_no_error (error);
475   res = g_regex_match (regex, "Mon Tuesday Wed Saturday", 0, &match);
476@@ -1895,7 +1896,7 @@ test_subpattern (void)
477   g_match_info_free (match);
478   g_regex_unref (regex);
479
480-  regex = g_regex_new ("^(a|b\\1)+$", G_REGEX_OPTIMIZE|G_REGEX_DUPNAMES, 0, &error);
481+  regex = g_regex_new ("^(a|b\\1)+$", G_REGEX_OPTIMIZE|G_REGEX_DUPNAMES, G_REGEX_MATCH_DEFAULT, &error);
482   g_assert (regex);
483   g_assert_no_error (error);
484   res = g_regex_match (regex, "aaaaaaaaaaaaaaaa", 0, &match);
485@@ -1919,7 +1920,7 @@ test_condition (void)
486   gboolean res;
487
488   error = NULL;
489-  regex = g_regex_new ("^(a+)(\\()?[^()]+(?(-1)\\))(b+)$", G_REGEX_OPTIMIZE, 0, &error);
490+  regex = g_regex_new ("^(a+)(\\()?[^()]+(?(-1)\\))(b+)$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
491   g_assert (regex);
492   g_assert_no_error (error);
493   res = g_regex_match (regex, "a(zzzzzz)b", 0, &match);
494@@ -1933,7 +1934,7 @@ test_condition (void)
495   g_regex_unref (regex);
496
497   error = NULL;
498-  regex = g_regex_new ("^(a+)(?<OPEN>\\()?[^()]+(?(<OPEN>)\\))(b+)$", G_REGEX_OPTIMIZE, 0, &error);
499+  regex = g_regex_new ("^(a+)(?<OPEN>\\()?[^()]+(?(<OPEN>)\\))(b+)$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
500   g_assert (regex);
501   g_assert_no_error (error);
502   res = g_regex_match (regex, "a(zzzzzz)b", 0, &match);
503@@ -1946,7 +1947,7 @@ test_condition (void)
504   g_match_info_free (match);
505   g_regex_unref (regex);
506
507-  regex = g_regex_new ("^(a+)(?(+1)\\[|\\<)?[^()]+(\\])?(b+)$", G_REGEX_OPTIMIZE, 0, &error);
508+  regex = g_regex_new ("^(a+)(?(+1)\\[|\\<)?[^()]+(\\])?(b+)$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
509   g_assert (regex);
510   g_assert_no_error (error);
511   res = g_regex_match (regex, "a[zzzzzz]b", 0, &match);
512@@ -2013,7 +2014,7 @@ test_recursion (void)
513   gint start;
514
515   error = NULL;
516-  regex = g_regex_new ("\\( ( [^()]++ | (?R) )* \\)", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, 0, &error);
517+  regex = g_regex_new ("\\( ( [^()]++ | (?R) )* \\)", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, G_REGEX_MATCH_DEFAULT, &error);
518   g_assert (regex);
519   g_assert_no_error (error);
520   res = g_regex_match (regex, "(middle)", 0, &match);
521@@ -2030,7 +2031,7 @@ test_recursion (void)
522   g_match_info_free (match);
523   g_regex_unref (regex);
524
525-  regex = g_regex_new ("^( \\( ( [^()]++ | (?1) )* \\) )$", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, 0, &error);
526+  regex = g_regex_new ("^( \\( ( [^()]++ | (?1) )* \\) )$", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, G_REGEX_MATCH_DEFAULT, &error);
527   g_assert (regex);
528   g_assert_no_error (error);
529   res = g_regex_match (regex, "((((((((((((((((middle))))))))))))))))", 0, &match);
530@@ -2043,7 +2044,7 @@ test_recursion (void)
531   g_match_info_free (match);
532   g_regex_unref (regex);
533
534-  regex = g_regex_new ("^(?<pn> \\( ( [^()]++ | (?&pn) )* \\) )$", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, 0, &error);
535+  regex = g_regex_new ("^(?<pn> \\( ( [^()]++ | (?&pn) )* \\) )$", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, G_REGEX_MATCH_DEFAULT, &error);
536   g_assert (regex);
537   g_assert_no_error (error);
538   g_regex_match (regex, "(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()", 0, &match);
539@@ -2052,7 +2053,7 @@ test_recursion (void)
540   g_match_info_free (match);
541   g_regex_unref (regex);
542
543-  regex = g_regex_new ("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, 0, &error);
544+  regex = g_regex_new ("< (?: (?(R) \\d++ | [^<>]*+) | (?R)) * >", G_REGEX_OPTIMIZE|G_REGEX_EXTENDED, G_REGEX_MATCH_DEFAULT, &error);
545   g_assert (regex);
546   g_assert_no_error (error);
547   res = g_regex_match (regex, "<ab<01<23<4>>>>", 0, &match);
548@@ -2071,7 +2072,7 @@ test_recursion (void)
549   g_match_info_free (match);
550   g_regex_unref (regex);
551
552-  regex = g_regex_new ("^((.)(?1)\\2|.)$", G_REGEX_OPTIMIZE, 0, &error);
553+  regex = g_regex_new ("^((.)(?1)\\2|.)$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
554   g_assert (regex);
555   g_assert_no_error (error);
556   res = g_regex_match (regex, "abcdcba", 0, &match);
557@@ -2084,7 +2085,7 @@ test_recursion (void)
558   g_match_info_free (match);
559   g_regex_unref (regex);
560
561-  regex = g_regex_new ("^(?:((.)(?1)\\2|)|((.)(?3)\\4|.))$", G_REGEX_OPTIMIZE, 0, &error);
562+  regex = g_regex_new ("^(?:((.)(?1)\\2|)|((.)(?3)\\4|.))$", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT, &error);
563   g_assert (regex);
564   g_assert_no_error (error);
565   res = g_regex_match (regex, "abcdcba", 0, &match);
566@@ -2097,7 +2098,7 @@ test_recursion (void)
567   g_match_info_free (match);
568   g_regex_unref (regex);
569
570-  regex = g_regex_new ("^\\W*+(?:((.)\\W*+(?1)\\W*+\\2|)|((.)\\W*+(?3)\\W*+\\4|\\W*+.\\W*+))\\W*+$", G_REGEX_OPTIMIZE|G_REGEX_CASELESS, 0, &error);
571+  regex = g_regex_new ("^\\W*+(?:((.)\\W*+(?1)\\W*+\\2|)|((.)\\W*+(?3)\\W*+\\4|\\W*+.\\W*+))\\W*+$", G_REGEX_OPTIMIZE|G_REGEX_CASELESS, G_REGEX_MATCH_DEFAULT, &error);
572   g_assert (regex);
573   g_assert_no_error (error);
574   res = g_regex_match (regex, "abcdcba", 0, &match);
575@@ -2124,7 +2125,7 @@ test_multiline (void)
576
577   g_test_bug ("https://bugzilla.gnome.org/show_bug.cgi?id=640489");
578
579-  regex = g_regex_new ("^a$", G_REGEX_MULTILINE|G_REGEX_DOTALL, 0, NULL);
580+  regex = g_regex_new ("^a$", G_REGEX_MULTILINE|G_REGEX_DOTALL, G_REGEX_MATCH_DEFAULT, NULL);
581
582   count = 0;
583   g_regex_match (regex, "a\nb\na", 0, &info);
584@@ -2144,7 +2145,7 @@ test_explicit_crlf (void)
585 {
586   GRegex *regex;
587
588-  regex = g_regex_new ("[\r\n]a", 0, 0, NULL);
589+  regex = g_regex_new ("[\r\n]a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
590   g_assert_cmpint (g_regex_get_has_cr_or_lf (regex), ==, TRUE);
591   g_regex_unref (regex);
592 }
593@@ -2154,15 +2155,15 @@ test_max_lookbehind (void)
594 {
595   GRegex *regex;
596
597-  regex = g_regex_new ("abc", 0, 0, NULL);
598+  regex = g_regex_new ("abc", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
599   g_assert_cmpint (g_regex_get_max_lookbehind (regex), ==, 0);
600   g_regex_unref (regex);
601
602-  regex = g_regex_new ("\\babc", 0, 0, NULL);
603+  regex = g_regex_new ("\\babc", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
604   g_assert_cmpint (g_regex_get_max_lookbehind (regex), ==, 1);
605   g_regex_unref (regex);
606
607-  regex = g_regex_new ("(?<=123)abc", 0, 0, NULL);
608+  regex = g_regex_new ("(?<=123)abc", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
609   g_assert_cmpint (g_regex_get_max_lookbehind (regex), ==, 3);
610   g_regex_unref (regex);
611 }
612@@ -2205,25 +2206,25 @@ main (int argc, char *argv[])
613
614   /* TEST_NEW(pattern, compile_opts, match_opts) */
615   TEST_NEW("[A-Z]+", G_REGEX_CASELESS | G_REGEX_EXTENDED | G_REGEX_OPTIMIZE, G_REGEX_MATCH_NOTBOL | G_REGEX_MATCH_PARTIAL);
616-  TEST_NEW("", 0, 0);
617-  TEST_NEW(".*", 0, 0);
618-  TEST_NEW(".*", G_REGEX_OPTIMIZE, 0);
619-  TEST_NEW(".*", G_REGEX_MULTILINE, 0);
620-  TEST_NEW(".*", G_REGEX_DOTALL, 0);
621+  TEST_NEW("", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
622+  TEST_NEW(".*", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
623+  TEST_NEW(".*", G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT);
624+  TEST_NEW(".*", G_REGEX_MULTILINE, G_REGEX_MATCH_DEFAULT);
625+  TEST_NEW(".*", G_REGEX_DOTALL, G_REGEX_MATCH_DEFAULT);
626   TEST_NEW(".*", G_REGEX_DOTALL, G_REGEX_MATCH_NOTBOL);
627-  TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", 0, 0);
628-  TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_CASELESS, 0);
629-  TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_CASELESS | G_REGEX_OPTIMIZE, 0);
630-  TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES, 0);
631-  TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES | G_REGEX_OPTIMIZE, 0);
632+  TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
633+  TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_CASELESS, G_REGEX_MATCH_DEFAULT);
634+  TEST_NEW("(123\\d*)[a-zA-Z]+(?P<hello>.*)", G_REGEX_CASELESS | G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT);
635+  TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES, G_REGEX_MATCH_DEFAULT);
636+  TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES | G_REGEX_OPTIMIZE, G_REGEX_MATCH_DEFAULT);
637   /* This gives "internal error: code overflow" with pcre 6.0 */
638-  TEST_NEW("(?i)(?-i)", 0, 0);
639-  TEST_NEW ("(?i)a", 0, 0);
640-  TEST_NEW ("(?m)a", 0, 0);
641-  TEST_NEW ("(?s)a", 0, 0);
642-  TEST_NEW ("(?x)a", 0, 0);
643-  TEST_NEW ("(?J)a", 0, 0);
644-  TEST_NEW ("(?U)[a-z]+", 0, 0);
645+  TEST_NEW("(?i)(?-i)", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
646+  TEST_NEW ("(?i)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
647+  TEST_NEW ("(?m)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
648+  TEST_NEW ("(?s)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
649+  TEST_NEW ("(?x)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
650+  TEST_NEW ("(?J)a", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
651+  TEST_NEW ("(?U)[a-z]+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT);
652
653   /* TEST_NEW_CHECK_FLAGS(pattern, compile_opts, match_ops, real_compile_opts, real_match_opts) */
654   TEST_NEW_CHECK_FLAGS ("a", G_REGEX_OPTIMIZE, 0, G_REGEX_OPTIMIZE, 0);
655diff --git a/gobject/tests/boxed.c b/gobject/tests/boxed.c
656index c2d091c54a..dd45a80a34 100644
657--- a/gobject/tests/boxed.c
658+++ b/gobject/tests/boxed.c
659@@ -281,7 +281,7 @@ test_boxed_regex (void)
660   g_value_init (&value, G_TYPE_REGEX);
661   g_assert (G_VALUE_HOLDS_BOXED (&value));
662
663-  v = g_regex_new ("a+b+", 0, 0, NULL);
664+  v = g_regex_new ("a+b+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
665   g_value_take_boxed (&value, v);
666
667   v2 = g_value_get_boxed (&value);
668@@ -305,7 +305,7 @@ test_boxed_matchinfo (void)
669   g_value_init (&value, G_TYPE_MATCH_INFO);
670   g_assert (G_VALUE_HOLDS_BOXED (&value));
671
672-  r = g_regex_new ("ab", 0, 0, NULL);
673+  r = g_regex_new ("ab", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL);
674   ret = g_regex_match (r, "blabla abab bla", 0, &info);
675   g_assert (ret);
676   g_value_take_boxed (&value, info);
677--
678GitLab
679
680