From c646b936aeb68ae78194ec6e713459beca58afe5 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 17 Jan 2017 15:51:26 +0900 Subject: [PATCH] Fix defining the log When the dlog is enabled, calling fprintf() is unnecessary. And, this patch removes the unnecessary definition of the do-while loop. Change-Id: Ibe376ba9177d425bf5902d6e3949e653c4c297f4 Signed-off-by: Hwankyu Jhun --- include/appcore-internal.h | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/include/appcore-internal.h b/include/appcore-internal.h index 97e84a7..c1f9bb3 100644 --- a/include/appcore-internal.h +++ b/include/appcore-internal.h @@ -37,26 +37,18 @@ #endif #ifndef _DLOG_H_ -# define _ERR(fmt, arg...) \ - do { fprintf(stderr, "appcore: "fmt"\n", ##arg); } while (0) - -# define _INFO(fmt, arg...) \ - do { fprintf(stdout, fmt"\n", ##arg); } while (0) - -# define _DBG(fmt, arg...) \ +#define _ERR(fmt, arg...) fprintf(stderr, "appcore: "fmt"\n", ##arg) +#define _INFO(fmt, arg...) fprintf(stdout, fmt"\n", ##arg) +#define _DBG(fmt, arg...) \ do { \ if (getenv("APPCORE_DEBUG")) { \ fprintf(stdout, fmt"\n", ##arg); \ } \ } while (0) #else -# define _ERR(fmt, arg...) \ - do { \ - fprintf(stderr, "appcore: "fmt"\n", ##arg); \ - LOGE(fmt, ##arg); \ - } while (0) -# define _INFO(...) LOGI(__VA_ARGS__) -# define _DBG(...) LOGD(__VA_ARGS__) +#define _ERR(fmt, arg...) LOGE(fmt, ##arg) +#define _INFO(...) LOGI(__VA_ARGS__) +#define _DBG(...) LOGD(__VA_ARGS__) #endif #define _warn_if(expr, fmt, arg...) do { \ -- 2.7.4