]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Make more use of native GLib.Regex syntax
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 22 Dec 2021 08:16:52 +0000 (09:16 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 22 Dec 2021 08:16:52 +0000 (09:16 +0100)
ccode/valaccodewriter.vala
libvaladoc/errorreporter.vala
vala/valareport.vala

index 21cc4172092b692df7f38e766904af965bf5fdc6..11a3b0e31c9e2f7cf110ac539083a9bc6ea7ca2f 100644 (file)
@@ -48,8 +48,6 @@ public class Vala.CCodeWriter {
                get { return _bol; }
        }
 
-       static GLib.Regex fix_indent_regex;
-
        private string temp_filename;
        private bool file_exists;
 
@@ -246,8 +244,7 @@ public class Vala.CCodeWriter {
                        bool first = true;
 
                        // discard tabs at beginning of line
-                       if (fix_indent_regex == null)
-                               fix_indent_regex = new GLib.Regex ("^\t+");;
+                       unowned Regex fix_indent_regex = /^\t+/;
 
                        foreach (unowned string line in text.split ("\n")) {
                                if (!first) {
index 68b09a8ef8ef4f6fc1e970f3d0a5f97548f675c3..b6035e0fe1c4e6a6ca39ac104ae448b1e5d23b5c 100644 (file)
@@ -137,12 +137,7 @@ public class Valadoc.ErrorReporter : Object {
         * }}}
         */
        public bool set_colors (string str) {
-               Regex val_regex;
-               try {
-                       val_regex = new Regex ("^\\s*[0-9]+(;[0-9]*)*\\s*$");
-               } catch (RegexError e) {
-                       assert_not_reached ();
-               }
+               unowned Regex val_regex = /^\\s*[0-9]+(;[0-9]*)*\\s*$/;
 
                string error_color = null;
                string warning_color = null;
index 3d3a95fc8759b4e92553a9658b7885e0b8040bd9..9665c2d116eb29c54ffb9c550f8ce3f09ddcf20f 100644 (file)
@@ -106,8 +106,6 @@ public class Vala.Report {
 
        public bool enable_warnings { get; set; default = true; }
 
-       static GLib.Regex val_regex;
-
        /**
         * Set all colors by string
         *
@@ -116,12 +114,7 @@ public class Vala.Report {
         * }}}
         */
        public bool set_colors (string str, Report.Colored colored_output = Report.Colored.AUTO) {
-               try {
-                       if (val_regex == null)
-                               val_regex = new Regex ("^\\s*[0-9]+(;[0-9]*)*\\s*$");
-               } catch (RegexError e) {
-                       assert_not_reached ();
-               }
+               unowned Regex val_regex = /^\\s*[0-9]+(;[0-9]*)*\\s*$/;
 
                string error_color = null;
                string warning_color = null;