From: Mike Yuan Date: Thu, 23 Nov 2023 12:52:16 +0000 (+0800) Subject: analyze: use FOREACH_ARRAY more X-Git-Tag: v255-rc4~63^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9136de69342b5ff03547e0c10d64bd28d0bd6b21;p=thirdparty%2Fsystemd.git analyze: use FOREACH_ARRAY more --- diff --git a/src/analyze/analyze-verify-util.c b/src/analyze/analyze-verify-util.c index ae4164d053c..5bba388dfc9 100644 --- a/src/analyze/analyze-verify-util.c +++ b/src/analyze/analyze-verify-util.c @@ -168,12 +168,12 @@ static int verify_executables(Unit *u, const char *root) { RET_GATHER(r, verify_executable(u, exec, root)); if (u->type == UNIT_SERVICE) - for (unsigned i = 0; i < ELEMENTSOF(SERVICE(u)->exec_command); i++) - RET_GATHER(r, verify_executable(u, SERVICE(u)->exec_command[i], root)); + FOREACH_ARRAY(i, SERVICE(u)->exec_command, ELEMENTSOF(SERVICE(u)->exec_command)) + RET_GATHER(r, verify_executable(u, *i, root)); if (u->type == UNIT_SOCKET) - for (unsigned i = 0; i < ELEMENTSOF(SOCKET(u)->exec_command); i++) - RET_GATHER(r, verify_executable(u, SOCKET(u)->exec_command[i], root)); + FOREACH_ARRAY(i, SOCKET(u)->exec_command, ELEMENTSOF(SOCKET(u)->exec_command)) + RET_GATHER(r, verify_executable(u, *i, root)); return r; } @@ -225,7 +225,7 @@ static int verify_unit(Unit *u, bool check_man, const char *root) { return r; } -static void set_destroy_ignore_pointer_max(Set** s) { +static void set_destroy_ignore_pointer_max(Set **s) { if (*s == POINTER_MAX) return; set_free_free(*s); @@ -302,8 +302,8 @@ int verify_units( count++; } - for (int i = 0; i < count; i++) - RET_GATHER(r, verify_unit(units[i], check_man, root)); + FOREACH_ARRAY(i, units, count) + RET_GATHER(r, verify_unit(*i, check_man, root)); if (s == POINTER_MAX) return log_oom();