]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
conf-parse: use strjoina() where appropriate
authorLennart Poettering <lennart@poettering.net>
Fri, 16 Nov 2018 17:08:29 +0000 (18:08 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 17 Nov 2018 07:47:27 +0000 (08:47 +0100)
src/shared/conf-parser.c

index b417ac2d6d8716debc4fd6c55d908c50da9fd0ac..8110b2cb16884e66bc8f2e0250463365d3780148 100644 (file)
@@ -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,