From: Alejandro Colomar Date: Mon, 4 Nov 2024 15:37:48 +0000 (+0100) Subject: src/: Transform do-while into while X-Git-Tag: 4.17.0-rc1~15 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c8c105938480d0e2c531049292923f1c969d1332;p=thirdparty%2Fshadow.git 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 --- diff --git a/src/useradd.c b/src/useradd.c index 058b09d92..891fd1420 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -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 (); diff --git a/src/usermod.c b/src/usermod.c index 8cff1d67f..f33aec31e 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -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;