From: Frantisek Sumsal Date: Mon, 14 Sep 2020 14:13:44 +0000 (+0200) Subject: core: consolidate alloc & put operations into one statement X-Git-Tag: v247-rc1~237^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=973bc32ab68ccbe6a46943cdeee066993ac13861;p=thirdparty%2Fsystemd.git core: consolidate alloc & put operations into one statement --- diff --git a/src/core/unit.c b/src/core/unit.c index 96a21b95b3f..c3d7d24eccd 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -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);