From: Zbigniew Jędrzejewski-Szmek Date: Wed, 26 Jun 2019 09:52:57 +0000 (+0200) Subject: core: move assert before actual use of the variable X-Git-Tag: v243-rc1~222^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=48f48b8c7cfbbea44eca91eb21e408dfeb9e22a9;p=thirdparty%2Fsystemd.git core: move assert before actual use of the variable No point in using u->id first, and doing assert(u) later. -std=c89 strikes again. --- diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c index 72391ace3a9..ffa12d8a929 100644 --- a/src/core/unit-printf.c +++ b/src/core/unit-printf.c @@ -244,6 +244,10 @@ int unit_full_printf(Unit *u, const char *format, char **ret) { * before or after the relevant configuration setting. Hence: don't add them. */ + assert(u); + assert(format); + assert(ret); + const Specifier table[] = { { 'n', specifier_string, u->id }, { 'N', specifier_prefix_and_instance, NULL }, @@ -281,9 +285,5 @@ int unit_full_printf(Unit *u, const char *format, char **ret) { {} }; - assert(u); - assert(format); - assert(ret); - return specifier_printf(format, table, u, ret); }