src/: Transform do-while into while

list cannot be NULL in the first iteration, so we don't need a do-while.

Just in case it's not obvious: we know it's not NULL in the first
iteration because right above, in line 772, we've already dereferenced
it.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-11-04 16:37:48 +01:00
committed by Serge Hallyn
parent 90afe61003
commit c8c1059384
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -784,7 +784,7 @@ static int get_groups (char *list)
* each name and look it up. A mix of numerical and string
* values for group identifiers is permitted.
*/
do {
while (NULL != list) {
char *g;
/*
@@ -832,7 +832,7 @@ static int get_groups (char *list)
*/
user_groups[ngroups++] = xstrdup (grp->gr_name);
gr_free (grp);
} while (NULL != list);
}
close_group_files ();
unlock_group_files ();
+2 -2
View File
@@ -236,7 +236,7 @@ static int get_groups (char *list)
* name and look it up. A mix of numerical and string values for
* group identifiers is permitted.
*/
do {
while (NULL != list) {
char *g;
/*
@@ -281,7 +281,7 @@ static int get_groups (char *list)
*/
user_groups[ngroups++] = xstrdup (grp->gr_name);
gr_free (grp);
} while (NULL != list);
}
user_groups[ngroups] = NULL;