summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrofl0r <rofl0r@users.noreply.github.com>2020-09-30 05:31:56 +0100
committerrofl0r <rofl0r@users.noreply.github.com>2020-09-30 05:31:56 +0100
commit3950a606a47fa62b46ecfa0ac45dbb7e1fa3bb8a (patch)
tree362fa366f565507cbd32238fc614278358ced525
parenta8944b93e707a8f3ba9fde0ba530ee8f4427f950 (diff)
conf: only treat space and tab as whitespace
other characters in the [[:space:]] set can't possibly be encountered, and this speeds up parsing by approximately 10%.
-rw-r--r--src/conf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/conf.c b/src/conf.c
index 6deaa10..b7c4b75 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -50,7 +50,8 @@
* given directive.
*/
#define DIGIT "[0-9]"
-#define WS "[[:space:]]+"
+#define SPACE "[ \t]"
+#define WS SPACE "+"
#define STR "\"([^\"]+)\""
#define BOOL "(yes|on|no|off)"
#define INT "(()" DIGIT "+)"
@@ -65,8 +66,8 @@
")"
#define IPV6MASK "(" IPV6 "(/" DIGIT "+)?)"
-#define BEGIN "^[[:space:]]*"
-#define END "[[:space:]]*$"
+#define BEGIN "^" SPACE "*"
+#define END SPACE "*$"
/*
* Limit the maximum number of substring matches to a reasonably high