summaryrefslogtreecommitdiffstats
path: root/trace
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-08-12 13:41:56 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-08-17 09:38:59 -0400
commitaaea92f5620e6eca30a5ca155397a749271d3208 (patch)
treeee6ff8e31f04560f19866c039c3cf67485b22964 /trace
parentdba096ac81f68ee1a7c49bb6232285dc0211bf10 (diff)
downloadding-libs-aaea92f5620e6eca30a5ca155397a749271d3208.tar.gz
ding-libs-aaea92f5620e6eca30a5ca155397a749271d3208.tar.xz
ding-libs-aaea92f5620e6eca30a5ca155397a749271d3208.zip
TRACE: Making sure trace is safe to output NULL strings
Patch adds checks for NULL to the trace macros. It also eliminates the unused trace.h in the collection directory.
Diffstat (limited to 'trace')
-rw-r--r--trace/trace.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/trace/trace.h b/trace/trace.h
index 9211e20..b2604fd 100644
--- a/trace/trace.h
+++ b/trace/trace.h
@@ -45,7 +45,8 @@ extern unsigned trace_level;
do { \
if (level & trace_level) { \
printf("[DEBUG] %23s (%4d) %s %s\n", \
- __FILE__, __LINE__, msg, str); \
+ __FILE__, __LINE__, (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (str != NULL) ? str : "(null)"); \
} \
} while(0)
@@ -54,7 +55,8 @@ extern unsigned trace_level;
do { \
if (level & trace_level) { \
printf("[DEBUG] %23s (%4d) %s %lu\n", \
- __FILE__, __LINE__, msg, (unsigned long int)(num)); \
+ __FILE__, __LINE__, (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (unsigned long int)(num)); \
} \
} while(0)
@@ -63,7 +65,8 @@ extern unsigned trace_level;
do { \
if (level & trace_level) { \
printf("[DEBUG] %23s (%4d) %s %e\n", \
- __FILE__, __LINE__, msg, (double)(num)); \
+ __FILE__, __LINE__, (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (double)(num)); \
} \
} while(0)