]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: consolidate alloc & put operations into one statement
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 14 Sep 2020 14:13:44 +0000 (16:13 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 14 Sep 2020 14:13:44 +0000 (16:13 +0200)
src/core/unit.c

index 96a21b95b3fc7214436b0c5d7539cef72c88cbe6..c3d7d24eccdf369ff9301836d6b8977596f0d841 100644 (file)
@@ -209,11 +209,7 @@ static int unit_add_alias(Unit *u, char *donated_name) {
 
         /* Make sure that u->names is allocated. We may leave u->names
          * empty if we fail later, but this is not a problem. */
-        r = set_ensure_allocated(&u->aliases, &string_hash_ops);
-        if (r < 0)
-                return r;
-
-        r = set_put(u->aliases, donated_name);
+        r = set_ensure_put(&u->aliases, &string_hash_ops, donated_name);
         if (r < 0)
                 return r;
         assert(r > 0);