From: Zbigniew Jędrzejewski-Szmek Date: Mon, 5 Jul 2021 19:56:39 +0000 (+0200) Subject: Inline some iterator variables X-Git-Tag: v250-rc1~952^2~13 X-Git-Url: http://git-history.diyao.me/?a=commitdiff_plain;h=6c1abe880781b1e8145c53d5e959cd55c53ee245;p=systemd%2F.git Inline some iterator variables --- diff --git a/src/core/socket.c b/src/core/socket.c index bbaafe68c8..0ae53e7336 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -563,7 +563,6 @@ _const_ static const char* listen_lookup(int family, int type) { } static void socket_dump(Unit *u, FILE *f, const char *prefix) { - SocketExecCommand c; Socket *s = SOCKET(u); SocketPort *p; const char *prefix2, *str; @@ -797,7 +796,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { exec_context_dump(&s->exec_context, f, prefix); kill_context_dump(&s->kill_context, f, prefix); - for (c = 0; c < _SOCKET_EXEC_COMMAND_MAX; c++) { + for (SocketExecCommand c = 0; c < _SOCKET_EXEC_COMMAND_MAX; c++) { if (!s->exec_command[c]) continue; @@ -3259,11 +3258,9 @@ int socket_collect_fds(Socket *s, int **fds) { return -ENOMEM; LIST_FOREACH(port, p, s->ports) { - size_t i; - if (p->fd >= 0) rfds[k++] = p->fd; - for (i = 0; i < p->n_auxiliary_fds; ++i) + for (size_t i = 0; i < p->n_auxiliary_fds; ++i) rfds[k++] = p->auxiliary_fds[i]; } diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index 11149d8e5b..65b188e88e 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -389,10 +389,8 @@ int bus_creds_dump(sd_bus_creds *c, FILE *f, bool terse) { fprintf(f, "%sFSGID=%s"GID_FMT"%s", prefix, color, c->fsgid, suffix); if (c->mask & SD_BUS_CREDS_SUPPLEMENTARY_GIDS) { - unsigned i; - fprintf(f, "%sSupplementaryGIDs=%s", prefix, color); - for (i = 0; i < c->n_supplementary_gids; i++) + for (unsigned i = 0; i < c->n_supplementary_gids; i++) fprintf(f, "%s" GID_FMT, i > 0 ? " " : "", c->supplementary_gids[i]); fprintf(f, "%s", suffix); }