From 973bc32ab68ccbe6a46943cdeee066993ac13861 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 14 Sep 2020 16:13:44 +0200 Subject: [PATCH] core: consolidate alloc & put operations into one statement --- src/core/unit.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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); -- 2.47.3