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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Mon May 26 00:59:42 UTC 2008


Author: nekral-guest
Date: 2008-05-26 00:59:42 +0000 (Mon, 26 May 2008)
New Revision: 2051

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


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-05-26 00:46:25 UTC (rev 2050)
+++ upstream/trunk/ChangeLog	2008-05-26 00:59:42 UTC (rev 2051)
@@ -1,5 +1,12 @@
 2008-05-26  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* lib/fputsx.c: Add brackets.
+	* lib/fputsx.c: Avoid assignments in comparisons.
+	* lib/fputsx.c: Avoid implicit conversion of pointers / integers /
+	chars to booleans.
+
+2008-05-26  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* lib/commonio.h: commonio_entry.changed, commonio_db.changed,
 	commonio_db.isopen, commonio_db.locked, and commonio_db.readonly
 	are no booleans.

Modified: upstream/trunk/lib/fputsx.c
===================================================================
--- upstream/trunk/lib/fputsx.c	2008-05-26 00:46:25 UTC (rev 2050)
+++ upstream/trunk/lib/fputsx.c	2008-05-26 00:59:42 UTC (rev 2051)
@@ -46,16 +46,22 @@
 
 	while (cnt > 0) {
 		if (fgets (cp, cnt, f) == 0) {
-			if (cp == buf)
+			if (cp == buf) {
 				return 0;
-			else
+			} else {
 				break;
+			}
 		}
-		if ((ep = strrchr (cp, '\\')) && *(ep + 1) == '\n') {
-			if ((cnt -= ep - cp) > 0)
-				*(cp = ep) = '\0';
-		} else
+		ep = strrchr (cp, '\\');
+		if ((NULL != ep) && (*(ep + 1) == '\n')) {
+			cnt -= ep - cp;
+			if (cnt > 0) {
+				cp = ep;
+				*cp = '\0';
+			}
+		} else {
 			break;
+		}
 	}
 	return buf;
 }
@@ -64,9 +70,10 @@
 {
 	int i;
 
-	for (i = 0; *s; i++, s++) {
-		if (putc (*s, stream) == EOF)
+	for (i = 0; '\0' != *s; i++, s++) {
+		if (putc (*s, stream) == EOF) {
 			return EOF;
+		}
 
 #if 0				/* The standard getgr*() can't handle that.  --marekm */
 		if (i > (BUFSIZ / 2)) {
@@ -80,3 +87,4 @@
 	}
 	return 0;
 }
+




More information about the Pkg-shadow-commits mailing list