summaryrefslogtreecommitdiffstats
path: root/trace
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2010-11-25 22:44:08 -0500
committerStephen Gallagher <sgallagh@redhat.com>2010-12-21 11:16:09 -0500
commit4c694864b8dba716cde0d3933145f3ffab346cdb (patch)
tree1594f058b1af3eca03cebe0a8a0291fea3fb6ef9 /trace
parent94e5ad22e13733a21ac612b601eb1ba5873d2b1e (diff)
downloadding-libs-4c694864b8dba716cde0d3933145f3ffab346cdb.tar.gz
ding-libs-4c694864b8dba716cde0d3933145f3ffab346cdb.tar.xz
ding-libs-4c694864b8dba716cde0d3933145f3ffab346cdb.zip
Fixing trace macros
One of the macros did not work, when I turned on tracing. The issue is that __FUNCTION__ should be treated as a variable and not as macro. This patch addressed the issue.
Diffstat (limited to 'trace')
-rw-r--r--trace/trace.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/trace/trace.h b/trace/trace.h
index d42d3ac..59d86a8 100644
--- a/trace/trace.h
+++ b/trace/trace.h
@@ -112,6 +112,14 @@ extern unsigned trace_level;
} \
} while(0)
+#define TRACE_RETURN(flow, val) \
+ do { \
+ char mstr[200]; \
+ sprintf(mstr, "%s returning:", __FUNCTION__); \
+ flow(mstr, val); \
+ } while(0)
+
+
/* Assertion */
#define TRACE_ASSERT(expression) expression ? : printf("ASSERTION FAILED\n")
#else /* HAVE_TRACE */
@@ -123,6 +131,7 @@ extern unsigned trace_level;
#define TRACE_LNUMBER(level, msg, num)
#define TRACE_SLNUMBER(level, msg, num)
#define TRACE_DOUBLE(level, msg, num)
+#define TRACE_RETURN(flow, val)
#endif /* HAVE_TRACE */
@@ -159,8 +168,7 @@ extern unsigned trace_level;
/* Some other nice wrappers for function entry and exit */
#define TRACE_FLOW_ENTRY() TRACE_FLOW_STRING(__FUNCTION__, "Entry")
#define TRACE_FLOW_EXIT() TRACE_FLOW_STRING(__FUNCTION__, "Exit")
-#define TRACE_FLOW_RETURN(val) \
- TRACE_FLOW_NUMBER(__FUNCTION__ " returning:", val)
+#define TRACE_FLOW_RETURN(val) TRACE_RETURN(TRACE_FLOW_NUMBER, val)
#endif /* COMMON_TRACE_H */