]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/io/syslog.h: SYSLOG_C(): Use a single local variable
authorAlejandro Colomar <alx@kernel.org>
Wed, 23 Jul 2025 17:59:02 +0000 (19:59 +0200)
committerSerge Hallyn <serge@hallyn.com>
Fri, 6 Mar 2026 01:44:32 +0000 (19:44 -0600)
There's no need for two variables, and this avoids one assignment.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/io/syslog.h

index bd58e088f1241a39fb7122450cfa6d7caf8d2042..db05c31b6da4dfea6b7ef11171a9ad9c01449bc1 100644 (file)
 #define SYSLOG_C(...)  do                                             \
 {                                                                     \
        char  *l_;                                                    \
-       char  *saved_locale;                                          \
                                                                      \
        l_ = setlocale(LC_ALL, NULL);                                 \
-       saved_locale = NULL;                                          \
                                                                      \
        if (NULL != l_)                                               \
-               saved_locale = strdup(l_);                            \
+               l_ = strdup(l_);                                      \
                                                                      \
-       if (NULL != saved_locale)                                     \
+       if (NULL != l_)                                               \
                setlocale(LC_ALL, "C");                               \
                                                                      \
        syslog(__VA_ARGS__);                                          \
-       if (NULL != saved_locale) {                                   \
-               setlocale(LC_ALL, saved_locale);                      \
-               free(saved_locale);                                   \
+       if (NULL != l_) {                                             \
+               setlocale(LC_ALL, l_);                                \
+               free(l_);                                             \
        }                                                             \
 } while (0)