From: Mike Yuan Date: Wed, 27 Sep 2023 19:00:13 +0000 (+0800) Subject: core/unit: use RET_GATHER in one more function X-Git-Tag: v255-rc1~406^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=95f7492875f00feb46ff32cda690e945453f92c7;p=thirdparty%2Fsystemd.git core/unit: use RET_GATHER in one more function --- diff --git a/src/core/unit.c b/src/core/unit.c index 09fe023ae2e..ba3af56303d 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3786,7 +3786,7 @@ int unit_add_blockdev_dependency(Unit *u, const char *what, UnitDependencyMask m } int unit_coldplug(Unit *u) { - int r = 0, q; + int r = 0; assert(u); @@ -3796,29 +3796,18 @@ int unit_coldplug(Unit *u) { u->coldplugged = true; - STRV_FOREACH(i, u->deserialized_refs) { - q = bus_unit_track_add_name(u, *i); - if (q < 0 && r >= 0) - r = q; - } + STRV_FOREACH(i, u->deserialized_refs) + RET_GATHER(r, bus_unit_track_add_name(u, *i)); + u->deserialized_refs = strv_free(u->deserialized_refs); - if (UNIT_VTABLE(u)->coldplug) { - q = UNIT_VTABLE(u)->coldplug(u); - if (q < 0 && r >= 0) - r = q; - } + if (UNIT_VTABLE(u)->coldplug) + RET_GATHER(r, UNIT_VTABLE(u)->coldplug(u)); - if (u->job) { - q = job_coldplug(u->job); - if (q < 0 && r >= 0) - r = q; - } - if (u->nop_job) { - q = job_coldplug(u->nop_job); - if (q < 0 && r >= 0) - r = q; - } + if (u->job) + RET_GATHER(r, job_coldplug(u->job)); + if (u->nop_job) + RET_GATHER(r, job_coldplug(u->nop_job)); CGroupContext *c = unit_get_cgroup_context(u); if (c)