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 -4
View File
@@ -132,7 +132,6 @@ int tempfn_random(const char *p, const char *extra, char **ret) {
const char *fn;
char *t, *x;
uint64_t u;
unsigned i;
assert(ret);
@@ -162,7 +161,7 @@ int tempfn_random(const char *p, const char *extra, char **ret) {
x = stpcpy(stpcpy(stpcpy(mempcpy(t, p, fn - p), ".#"), extra), fn);
u = random_u64();
for (i = 0; i < 16; i++) {
for (unsigned i = 0; i < 16; i++) {
*(x++) = hexchar(u & 0xF);
u >>= 4;
}
@@ -176,7 +175,6 @@ int tempfn_random(const char *p, const char *extra, char **ret) {
int tempfn_random_child(const char *p, const char *extra, char **ret) {
char *t, *x;
uint64_t u;
unsigned i;
int r;
assert(ret);
@@ -205,7 +203,7 @@ int tempfn_random_child(const char *p, const char *extra, char **ret) {
x = stpcpy(stpcpy(stpcpy(t, p), "/.#"), extra);
u = random_u64();
for (i = 0; i < 16; i++) {
for (unsigned i = 0; i < 16; i++) {
*(x++) = hexchar(u & 0xF);
u >>= 4;
}