tree-wide: make FOREACH_DIRENT_ALL define the iterator variable

The variable is not useful outside of the loop (it'll always be null
after the loop is finished), so we can declare it inline in the loop.
This saves one variable declaration and reduces the chances that somebody
tries to use the variable outside of the loop.

For consistency, 'de' is used everywhere for the var name.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-12-15 16:19:13 +01:00
parent 372e8592c6
commit c7f0d9e5ac
31 changed files with 71 additions and 116 deletions
-1
View File
@@ -103,7 +103,6 @@ int block_get_originating(dev_t dt, dev_t *ret) {
_cleanup_free_ char *t = NULL;
char p[SYS_BLOCK_PATH_MAX("/slaves")];
_cleanup_free_ char *first_found = NULL;
struct dirent *de;
const char *q;
dev_t devt;
int r;