[FIX] Fixed LOG_ONCE in swap_debug.h 47/44347/1
authorDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 21 Jul 2015 05:52:31 +0000 (08:52 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 21 Jul 2015 05:52:31 +0000 (08:52 +0300)
multiline defines should be in do-while block

Change-Id: Id3fea0516d57237a5e70b80223e1c25ea94ecb9e
Signed-off-by: Dmitry Kovalenko <d.kovalenko@samsung.com>
daemon/swap_debug.h

index 49de7b5..ff6608d 100644 (file)
@@ -76,12 +76,15 @@ void print_buf(char *buf, int len, const char *info);
        #define LOG_ONCE_VAR TOKENPASTE2(log_once_var_, __LINE__)
        #define INIT_LOG_ONCE static char LOG_ONCE_VAR = 0
 
-       #define LOG_ONCE(W_E,...)                               \
-               INIT_LOG_ONCE;                                  \
-               if (LOG_ONCE_VAR == 0) {                        \
-                       TOKENPASTE2(LOG, W_E)(__VA_ARGS__);     \
-                       LOG_ONCE_VAR = 1;                       \
-               }
+       #define LOG_ONCE(W_E,...)                                       \
+               do {                                                    \
+                       INIT_LOG_ONCE;                                  \
+                       if (LOG_ONCE_VAR == 0) {                        \
+                               TOKENPASTE2(LOG, W_E)(__VA_ARGS__);     \
+                               LOG_ONCE_VAR = 1;                       \
+                       }                                               \
+               } while (0)
+
        #define LOG_ONCE_E(...) LOG_ONCE(E, __VA_ARGS__)
        #define LOG_ONCE_W(...) LOG_ONCE(W, __VA_ARGS__)
 #else