[Pkg-shadow-commits] r2068 - in upstream/trunk: . lib
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Mon May 26 09:15:06 UTC 2008
Author: nekral-guest
Date: 2008-05-26 09:15:02 +0000 (Mon, 26 May 2008)
New Revision: 2068
Modified:
upstream/trunk/ChangeLog
upstream/trunk/lib/sgetpwent.c
Log:
* lib/sgetpwent.c: Avoid implicit conversion of pointers / chars to booleans.
* lib/sgetpwent.c: Add brackets and parenthesis.
* lib/sgetpwent.c: Return NULL instead of 0.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-05-26 09:12:34 UTC (rev 2067)
+++ upstream/trunk/ChangeLog 2008-05-26 09:15:02 UTC (rev 2068)
@@ -1,5 +1,13 @@
2008-05-26 Nicolas François <nicolas.francois at centraliens.net>
+ * lib/sgetpwent.c: Avoid implicit conversion of pointers / chars to
+ booleans.
+ * lib/sgetpwent.c: Add brackets and parenthesis.
+ * lib/sgetpwent.c: Return NULL instead of 0.
+
+
+2008-05-26 Nicolas François <nicolas.francois at centraliens.net>
+
* libmisc/getdate.y: abbrev is a bool.
* libmisc/getdate.y: Avoid implicit conversion of pointers / chars /
integers to booleans.
Modified: upstream/trunk/lib/sgetpwent.c
===================================================================
--- upstream/trunk/lib/sgetpwent.c 2008-05-26 09:12:34 UTC (rev 2067)
+++ upstream/trunk/lib/sgetpwent.c 2008-05-26 09:15:02 UTC (rev 2068)
@@ -77,15 +77,18 @@
* field. The fields are converted into NUL terminated strings.
*/
- for (cp = pwdbuf, i = 0; i < NFIELDS && cp; i++) {
+ for (cp = pwdbuf, i = 0; (i < NFIELDS) && (NULL != cp); i++) {
fields[i] = cp;
- while (*cp && *cp != ':')
- ++cp;
+ while (('\0' != *cp) && (':' != *cp)) {
+ cp++;
+ }
- if (*cp)
- *cp++ = '\0';
- else
- cp = 0;
+ if ('\0' != *cp) {
+ *cp = '\0';
+ cp++;
+ } else {
+ cp = NULL;
+ }
}
/*
@@ -94,7 +97,7 @@
*/
if (i != NFIELDS || *fields[2] == '\0' || *fields[3] == '\0')
- return 0;
+ return NULL;
/*
* Each of the fields is converted the appropriate data type
@@ -106,12 +109,12 @@
pwent.pw_name = fields[0];
pwent.pw_passwd = fields[1];
if (fields[2][0] == '\0' ||
- ((pwent.pw_uid = strtol (fields[2], &ep, 10)) == 0 && *ep)) {
- return 0;
+ ((pwent.pw_uid = strtol (fields[2], &ep, 10)) == 0 && ('\0' != *ep))) {
+ return NULL;
}
if (fields[3][0] == '\0' ||
- ((pwent.pw_gid = strtol (fields[3], &ep, 10)) == 0 && *ep)) {
- return 0;
+ ((pwent.pw_gid = strtol (fields[3], &ep, 10)) == 0 && ('\0' != *ep))) {
+ return NULL;
}
pwent.pw_gecos = fields[4];
pwent.pw_dir = fields[5];
@@ -119,3 +122,4 @@
return &pwent;
}
+
More information about the Pkg-shadow-commits
mailing list