]> granicus.if.org Git - shadow/commitdiff
* lib/defines.h: Avoid implicit conversion of pointers to
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 14 Jun 2008 23:41:38 +0000 (23:41 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 14 Jun 2008 23:41:38 +0000 (23:41 +0000)
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).

ChangeLog
lib/defines.h

index b248725564afabd9e0b9dbe056dae13982101c0f..700140173e52a82983d5d31437de3f7f5dd251a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-06-15  Nicolas François  <nicolas.francois@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@centraliens.net>
 
        * libmisc/failure.c: Check return values. If lseek() failed, avoid
index bfcd73f0ecab3fa77cbffaf6d02cc46926a28570..4d536fbefcd4402a85a7a6bd0a7cc6caddc7b0e8 100644 (file)
@@ -154,17 +154,20 @@ char *strchr (), *strrchr (), *strtok ();
  * --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 */