summaryrefslogtreecommitdiffstats
path: root/libutil
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2013-01-13 21:25:43 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2013-01-13 21:25:43 +0000
commit69591bd017359878fd2de680ec5ba2f1218e8553 (patch)
tree9ea3a190b3f8cd2c529fc8a70522b7e0a1abf153 /libutil
parent4327085bc7709eabd95968f31d8c6abb9fe3c92c (diff)
downloadpw-darwin-69591bd017359878fd2de680ec5ba2f1218e8553.tar.gz
pw-darwin-69591bd017359878fd2de680ec5ba2f1218e8553.tar.zst
pw-darwin-69591bd017359878fd2de680ec5ba2f1218e8553.zip
libutil: eliminate 'found' variable in gr_equal
Submitted by: Christoph Mallon <christoph.mallon gmx.de>
Diffstat (limited to 'libutil')
-rw-r--r--libutil/gr_util.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libutil/gr_util.c b/libutil/gr_util.c
index acb9767..5e35ebe 100644
--- a/libutil/gr_util.c
+++ b/libutil/gr_util.c
@@ -346,7 +346,6 @@ gr_equal(const struct group *gr1, const struct group *gr2)
{
int gr1_ndx;
int gr2_ndx;
- bool found;
/* Check that the non-member information is the same. */
if (gr1->gr_name == NULL || gr2->gr_name == NULL) {
@@ -367,17 +366,15 @@ gr_equal(const struct group *gr1, const struct group *gr2)
if (gr1->gr_mem != gr2->gr_mem)
return (false);
} else {
- for (found = false, gr1_ndx = 0; gr1->gr_mem[gr1_ndx] != NULL;
- gr1_ndx++) {
- for (gr2_ndx = 0; gr2->gr_mem[gr2_ndx] != NULL;
- gr2_ndx++)
+ for (gr1_ndx = 0; gr1->gr_mem[gr1_ndx] != NULL; gr1_ndx++) {
+ for (gr2_ndx = 0;; gr2_ndx++) {
+ if (gr2->gr_mem[gr2_ndx] == NULL)
+ return (false);
if (strcmp(gr1->gr_mem[gr1_ndx],
gr2->gr_mem[gr2_ndx]) == 0) {
- found = true;
break;
}
- if (!found)
- return (false);
+ }
}
/* Check that group2 does not have more members than group1. */