From: Hwankyu Jhun Date: Tue, 17 Jan 2017 06:51:26 +0000 (+0900) Subject: Fix defining the log X-Git-Tag: submit/tizen/20170119.062810^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fappfw%2Fapp-core.git;a=commitdiff_plain;h=c646b936aeb68ae78194ec6e713459beca58afe5 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 --- 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 { \