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
+1 -2
View File
@@ -580,7 +580,6 @@ static const char * const rlmap_initrd[] = {
const char* runlevel_to_target(const char *word) {
const char * const *rlmap_ptr;
size_t i;
if (!word)
return NULL;
@@ -593,7 +592,7 @@ const char* runlevel_to_target(const char *word) {
rlmap_ptr = in_initrd() ? rlmap_initrd : rlmap;
for (i = 0; rlmap_ptr[i]; i += 2)
for (size_t i = 0; rlmap_ptr[i]; i += 2)
if (streq(word, rlmap_ptr[i]))
return rlmap_ptr[i+1];