From 667fa51e73a3dca8a797975cfb60f87e15f96ae0 Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Wed, 7 Sep 2011 17:30:54 +0000 Subject: [PATCH] Changed debugging to use inline function rather than macro --- motorApp/MotorSrc/motordrvCom.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/motorApp/MotorSrc/motordrvCom.cc b/motorApp/MotorSrc/motordrvCom.cc index a3689967..68d98bfe 100644 --- a/motorApp/MotorSrc/motordrvCom.cc +++ b/motorApp/MotorSrc/motordrvCom.cc @@ -67,17 +67,16 @@ HeadURL: $URL$ /*----------------debugging-----------------*/ -#ifdef __GNUG__ - #ifdef DEBUG - #define Debug(l, f, args...) {if (l <= motordrvComdebug) printf(f, ## args);} - #else - #define Debug(l, f, args...) - #endif -#else - #define Debug() -#endif volatile int motordrvComdebug = 0; extern "C" {epicsExportAddress(int, motordrvComdebug);} +static inline void Debug(int level, const char *format, ...) { + #ifdef DEBUG + va_list pVar; + va_start(pVar, format); + if (level < motordrvComdebug) vprintf(format, pVar); + va_end(pVar); + #endif +} /* Function declarations. */