treewide: tighten variable scope in loops (#18372)

Also use _cleanup_free_ in one more place.
This commit is contained in:
Susant Sahani
2021-01-27 08:19:39 +01:00
committed by GitHub
parent 37baf8db56
commit fe96c0f86d
30 changed files with 74 additions and 127 deletions
+2 -6
View File
@@ -91,11 +91,9 @@ void safe_close_pair(int p[static 2]) {
}
void close_many(const int fds[], size_t n_fd) {
size_t i;
assert(fds || n_fd <= 0);
for (i = 0; i < n_fd; i++)
for (size_t i = 0; i < n_fd; i++)
safe_close(fds[i]);
}
@@ -179,11 +177,9 @@ int fd_cloexec(int fd, bool cloexec) {
}
_pure_ static bool fd_in_set(int fd, const int fdset[], size_t n_fdset) {
size_t i;
assert(n_fdset == 0 || fdset);
for (i = 0; i < n_fdset; i++)
for (size_t i = 0; i < n_fdset; i++)
if (fdset[i] == fd)
return true;