summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-11-16 18:08:29 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-11-17 08:47:27 +0100
commit4472fa6d2c324be002ea04dd10070f7bbac261cf (patch)
tree26b5db94672126fa3aac8ac4528a4d2543a12cd5
parentconf-parse: drop unused prototype (diff)
downloadsystemd-4472fa6d2c324be002ea04dd10070f7bbac261cf.tar.xz
systemd-4472fa6d2c324be002ea04dd10070f7bbac261cf.zip
conf-parse: use strjoina() where appropriate
-rw-r--r--src/shared/conf-parser.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index b417ac2d6d..8110b2cb16 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -82,19 +82,13 @@ int config_item_perf_lookup(
assert(ltype);
assert(data);
- if (!section)
- p = lookup(lvalue, strlen(lvalue));
- else {
- char *key;
-
- key = strjoin(section, ".", lvalue);
- if (!key)
- return -ENOMEM;
+ if (section) {
+ const char *key;
+ key = strjoina(section, ".", lvalue);
p = lookup(key, strlen(key));
- free(key);
- }
-
+ } else
+ p = lookup(lvalue, strlen(lvalue));
if (!p)
return 0;
@@ -132,7 +126,6 @@ static int next_assignment(
r = lookup(table, section, lvalue, &func, &ltype, &data, userdata);
if (r < 0)
return r;
-
if (r > 0) {
if (func)
return func(unit, filename, line, section, section_line,