[Pkg-shadow-commits] r2054 - in upstream/trunk: . lib

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Mon May 26 08:31:16 UTC 2008


Author: nekral-guest
Date: 2008-05-26 08:31:14 +0000 (Mon, 26 May 2008)
New Revision: 2054

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/sgetgrent.c
Log:
	* lib/sgetgrent.c: implicit conversion of pointers / chars to booleans.
	* lib/sgetgrent.c: Avoid assignments in comparisons.
	* lib/sgetgrent.c: Add brackets.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-05-26 01:07:13 UTC (rev 2053)
+++ upstream/trunk/ChangeLog	2008-05-26 08:31:14 UTC (rev 2054)
@@ -1,5 +1,12 @@
 2008-05-26  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* lib/sgetgrent.c: implicit conversion of pointers / chars to
+	booleans.
+	* lib/sgetgrent.c: Avoid assignments in comparisons.
+	* lib/sgetgrent.c: Add brackets.
+
+2008-05-26  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* lib/encrypt.c: Avoid implicit conversion of pointers to
 	booleans.
 	* lib/encrypt.c: Add parenthesis.

Modified: upstream/trunk/lib/sgetgrent.c
===================================================================
--- upstream/trunk/lib/sgetgrent.c	2008-05-26 01:07:13 UTC (rev 2053)
+++ upstream/trunk/lib/sgetgrent.c	2008-05-26 08:31:14 UTC (rev 2054)
@@ -87,10 +87,12 @@
 		if (!s || s[0] == '\0')
 			break;
 		members[i++] = s;
-		while (*s && *s != ',')
+		while (('\0' != *s) && (',' != *s)) {
 			s++;
-		if (*s)
+		}
+		if ('\0' != *s) {
 			*s++ = '\0';
+		}
 	}
 	members[i] = (char *) 0;
 	return members;
@@ -120,22 +122,30 @@
 	}
 	strcpy (grpbuf, buf);
 
-	if ((cp = strrchr (grpbuf, '\n')))
+	cp = strrchr (grpbuf, '\n');
+	if (NULL != cp) {
 		*cp = '\0';
+	}
 
 	for (cp = grpbuf, i = 0; i < NFIELDS && cp; i++) {
 		grpfields[i] = cp;
-		if ((cp = strchr (cp, ':')))
-			*cp++ = 0;
+		cp = strchr (cp, ':');
+		if (NULL != cp) {
+			*cp = '\0';
+			cp++;
+		}
 	}
-	if (i < (NFIELDS - 1) || *grpfields[2] == '\0')
-		return 0;
+	if (i < (NFIELDS - 1) || *grpfields[2] == '\0') {
+		return (struct group *) 0;
+	}
 	grent.gr_name = grpfields[0];
 	grent.gr_passwd = grpfields[1];
 	grent.gr_gid = atoi (grpfields[2]);
 	grent.gr_mem = list (grpfields[3]);
-	if (!grent.gr_mem)
+	if (NULL == grent.gr_mem) {
 		return (struct group *) 0;	/* out of memory */
+	}
 
 	return &grent;
 }
+




More information about the Pkg-shadow-commits mailing list