From owner-svn-src-head@FreeBSD.ORG Tue Nov 11 00:32:56 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 396101065674; Tue, 11 Nov 2008 00:32:56 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B6FB8FC1A; Tue, 11 Nov 2008 00:32:56 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAB0Wuv0086597; Tue, 11 Nov 2008 00:32:56 GMT (envelope-from scf@svn.freebsd.org) Received: (from scf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAB0WupL086596; Tue, 11 Nov 2008 00:32:56 GMT (envelope-from scf@svn.freebsd.org) Message-Id: <200811110032.mAB0WupL086596@svn.freebsd.org> From: Sean Farley Date: Tue, 11 Nov 2008 00:32:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184831 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Nov 2008 00:32:56 -0000 Author: scf Date: Tue Nov 11 00:32:55 2008 New Revision: 184831 URL: http://svn.freebsd.org/changeset/base/184831 Log: style(9) fixes. MFC after: 1 week Modified: head/lib/libutil/gr_util.c Modified: head/lib/libutil/gr_util.c ============================================================================== --- head/lib/libutil/gr_util.c Tue Nov 11 00:14:10 2008 (r184830) +++ head/lib/libutil/gr_util.c Tue Nov 11 00:32:55 2008 (r184831) @@ -28,29 +28,27 @@ __FBSDID("$FreeBSD$"); #include + #include #include +#include #include #include #include #include -#include - - static const char GroupLineFormat[] = "%s:%s:%ju:"; - /* * Compares two struct group's. */ int gr_equal(const struct group *gr1, const struct group *gr2) { - bool found; - bool equal; int gr1Ndx; int gr2Ndx; + bool equal; + bool found; /* Check that the non-member information is the same. */ equal = strcmp(gr1->gr_name, gr2->gr_name) == 0 && @@ -81,7 +79,6 @@ gr_equal(const struct group *gr1, const return (equal); } - /* * Make a group line out of a struct group. */ @@ -89,8 +86,8 @@ char * gr_make(const struct group *gr) { char *line; - int ndx; size_t lineSize; + int ndx; /* Calculate the length of the group line. */ lineSize = snprintf(NULL, 0, GroupLineFormat, gr->gr_name, @@ -114,17 +111,16 @@ gr_make(const struct group *gr) return (line); } - /* * Duplicate a struct group. */ struct group * gr_dup(const struct group *gr) { - int ndx; - int numMem; size_t len; struct group *ngr; + int ndx; + int numMem; /* Calculate size of group. */ len = sizeof(*gr) + @@ -134,7 +130,7 @@ gr_dup(const struct group *gr) if (gr->gr_mem != NULL) { for (; gr->gr_mem[numMem] != NULL; numMem++) len += strlen(gr->gr_mem[numMem]) + 1; - len += (numMem + 1) * sizeof(*(gr->gr_mem)); + len += (numMem + 1) * sizeof(*gr->gr_mem); } /* Create new group and copy old group into it. */ @@ -152,7 +148,7 @@ gr_dup(const struct group *gr) } if (gr->gr_mem != NULL) { ngr->gr_mem = (char **)((char *)ngr + len); - len += (numMem + 1) * sizeof(*(ngr->gr_mem)); + len += (numMem + 1) * sizeof(*ngr->gr_mem); for (ndx = 0; gr->gr_mem[ndx] != NULL; ndx++) { ngr->gr_mem[ndx] = (char *)ngr + len; len += sprintf(ngr->gr_mem[ndx], "%s", @@ -164,7 +160,6 @@ gr_dup(const struct group *gr) return (ngr); } - /* * Scan a line and place it into a group structure. */ @@ -180,14 +175,14 @@ __gr_scan(char *line, struct group *gr) return (false); *loc = '\0'; gr->gr_passwd = loc + 1; - if (*(gr->gr_passwd) == ':') - *(gr->gr_passwd) = '\0'; + if (*gr->gr_passwd == ':') + *gr->gr_passwd = '\0'; else { if ((loc = strchr(loc + 1, ':')) == NULL) return (false); *loc = '\0'; } - if (sscanf(loc + 1, "%u", &(gr->gr_gid)) != 1) + if (sscanf(loc + 1, "%u", &gr->gr_gid) != 1) return (false); /* Assign member information to structure. */ @@ -199,7 +194,7 @@ __gr_scan(char *line, struct group *gr) ndx = 0; do { if ((gr->gr_mem = reallocf(gr->gr_mem, - sizeof(*(gr->gr_mem)) * (ndx + 1))) == NULL) + sizeof(*gr->gr_mem) * (ndx + 1))) == NULL) return (false); gr->gr_mem[ndx] = strsep(&line, ","); } while (gr->gr_mem[ndx++] != NULL); @@ -208,16 +203,15 @@ __gr_scan(char *line, struct group *gr) return (true); } - /* * Create a struct group from a line. */ struct group * gr_scan(const char *line) { + struct group gr; char *lineCopy; struct group *newGr; - struct group gr; if ((lineCopy = strdup(line)) == NULL) return (NULL);