summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-11-27 12:33:48 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-11-27 13:56:28 +0100
commitb9d9fbe4112b3a40b94842b7d6a4ca95faa3f946 (patch)
tree8d83156d778d5121ee7e08550d1e86356c0d36c8
parentshared/bus-unit-util: word wrap (diff)
downloadsystemd-b9d9fbe4112b3a40b94842b7d6a4ca95faa3f946.tar.xz
systemd-b9d9fbe4112b3a40b94842b7d6a4ca95faa3f946.zip
shared/conf-parser: remove unnecessary whitespace skipping
The conf-parser machinery already removed whitespace before and after "=", no need to repeat this step. The test is adjusted to pass. It was testing an code path that doesn't happen normally, no point in doing that.
-rw-r--r--src/core/load-fragment.c3
-rw-r--r--src/test/test-conf-parser.c4
-rw-r--r--src/test/test-load-fragment.c2
3 files changed, 3 insertions, 6 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 54c71d3579..eaa3b7bf49 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -614,7 +614,6 @@ int config_parse_exec(
assert(e);
e += ltype;
- rvalue += strspn(rvalue, WHITESPACE);
if (isempty(rvalue)) {
/* An empty assignment resets the list */
@@ -1951,7 +1950,6 @@ int config_parse_service_timeout_abort(
assert(rvalue);
assert(s);
- rvalue += strspn(rvalue, WHITESPACE);
if (isempty(rvalue)) {
s->timeout_abort_set = false;
return 0;
@@ -5002,7 +5000,6 @@ int config_parse_timeout_abort(
assert(rvalue);
assert(timeout_usec);
- rvalue += strspn(rvalue, WHITESPACE);
if (isempty(rvalue)) {
*timeout_usec = false;
return 0;
diff --git a/src/test/test-conf-parser.c b/src/test/test-conf-parser.c
index 597265efa6..661eb1795a 100644
--- a/src/test/test-conf-parser.c
+++ b/src/test/test-conf-parser.c
@@ -227,8 +227,8 @@ static const char* const config_file[] = {
"[Section]\n"
"[Section]\n"
"setting1=1\n"
- "setting1=2\n"
- "setting1=1\n", /* repeated settings */
+ "setting1= 2 \t\n"
+ "setting1= 1\n", /* repeated settings */
"[Section]\n"
"[Section]\n"
diff --git a/src/test/test-load-fragment.c b/src/test/test-load-fragment.c
index 8d0a4ad2e2..7de286436d 100644
--- a/src/test/test-load-fragment.c
+++ b/src/test/test-load-fragment.c
@@ -146,7 +146,7 @@ static void test_config_parse_exec(void) {
log_info("/* no command, whitespace only, reset */");
r = config_parse_exec(NULL, "fake", 3, "section", 1,
- "LValue", 0, " ",
+ "LValue", 0, "",
&c, u);
assert_se(r == 0);
assert_se(c == NULL);