strv: make iterator in STRV_FOREACH() declaread in the loop

This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
This commit is contained in:
Yu Watanabe
2022-03-19 08:33:33 +09:00
parent 80a226b26b
commit de010b0b2e
210 changed files with 109 additions and 621 deletions
+1 -2
View File
@@ -13,7 +13,7 @@
#include "virt.h"
static int find_netcat_executable(char **ret_path) {
char **candidates = STRV_MAKE("ncat", "nc", "netcat"), **c;
char **candidates = STRV_MAKE("ncat", "nc", "netcat");
int r = 0;
STRV_FOREACH(c, candidates) {
@@ -35,7 +35,6 @@ static int test_socket_bind(
_cleanup_free_ char *exec_start = NULL;
_cleanup_(unit_freep) Unit *u = NULL;
CGroupContext *cc = NULL;
char **rule;
int cld_code, r;
assert_se(u = unit_new(m, sizeof(Service)));