Date: Sun, 13 Jan 2013 21:25:43 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245385 - head/lib/libutil Message-ID: <201301132125.r0DLPhOP099315@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Sun Jan 13 21:25:43 2013 New Revision: 245385 URL: http://svnweb.freebsd.org/changeset/base/245385 Log: libutil: eliminate 'found' variable in gr_equal Submitted by: Christoph Mallon <christoph.mallon gmx.de> Modified: head/lib/libutil/gr_util.c Modified: head/lib/libutil/gr_util.c ============================================================================== --- head/lib/libutil/gr_util.c Sun Jan 13 20:35:08 2013 (r245384) +++ head/lib/libutil/gr_util.c Sun Jan 13 21:25:43 2013 (r245385) @@ -346,7 +346,6 @@ gr_equal(const struct group *gr1, const { 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 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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301132125.r0DLPhOP099315>