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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-11-27 12:33:48 +01:00
parent c57d2a76c5
commit b9d9fbe411
3 changed files with 3 additions and 6 deletions

View file

@ -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;

View file

@ -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"

View file

@ -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);