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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sat Jun 14 23:41:39 UTC 2008


Author: nekral-guest
Date: 2008-06-14 23:41:38 +0000 (Sat, 14 Jun 2008)
New Revision: 2183

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/defines.h
Log:
	* lib/defines.h: Avoid implicit conversion of pointers to
	booleans.
	* lib/defines.h: Ignore return values of setlocale() except the
	first call.
	* lib/defines.h: Fix a splint observer warning by using an
	intermediate variable (old_locale).


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-06-14 23:38:43 UTC (rev 2182)
+++ upstream/trunk/ChangeLog	2008-06-14 23:41:38 UTC (rev 2183)
@@ -1,5 +1,14 @@
 2008-06-15  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* lib/defines.h: Avoid implicit conversion of pointers to
+	booleans.
+	* lib/defines.h: Ignore return values of setlocale() except the
+	first call.
+	* lib/defines.h: Fix a splint observer warning by using an
+	intermediate variable (old_locale).
+
+2008-06-15  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* libmisc/failure.c: Check return values. If lseek() failed, avoid
 	reading or writing at an unspecified location. Log to syslog in
 	case of failure when reading a faillog entry or writing in

Modified: upstream/trunk/lib/defines.h
===================================================================
--- upstream/trunk/lib/defines.h	2008-06-14 23:38:43 UTC (rev 2182)
+++ upstream/trunk/lib/defines.h	2008-06-14 23:41:38 UTC (rev 2183)
@@ -154,17 +154,20 @@
  * --Nekral */
 #define SYSLOG(x)							\
 	do {								\
-		char *saved_locale = setlocale(LC_ALL, NULL);		\
-		if (saved_locale)					\
-			saved_locale = strdup(saved_locale);		\
-		if (saved_locale)					\
-			setlocale(LC_ALL, "C");			\
+		char *old_locale = setlocale(LC_ALL, NULL);		\
+		char *saved_locale = NULL;				\
+		if (NULL != old_locale) {				\
+			saved_locale = strdup (old_locale);		\
+		}							\
+		if (NULL != saved_locale) {				\
+			(void) setlocale (LC_ALL, "C");			\
+		}							\
 		syslog x ;						\
-		if (saved_locale) {					\
-			setlocale(LC_ALL, saved_locale);		\
-			free(saved_locale);				\
+		if (NULL != saved_locale) {				\
+			(void) setlocale (LC_ALL, saved_locale);	\
+			free (saved_locale);				\
 		}							\
-	} while (0)
+	} while (false)
 #else				/* !ENABLE_NLS */
 #define SYSLOG(x) syslog x
 #endif				/* !ENABLE_NLS */




More information about the Pkg-shadow-commits mailing list