summaryrefslogtreecommitdiff
path: root/common/trace
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-04-07 14:25:28 -0400
committerSimo Sorce <ssorce@redhat.com>2009-04-07 14:25:28 -0400
commit7e0e2529c6b59e092317c9f4a95316b72e999336 (patch)
treec2f3ba654f5c05fd2a5f0e9d9fc182154a81651b /common/trace
parent2f2e7ac94c86ced957a0232e368985ba8c8f59e7 (diff)
downloadsssd-7e0e2529c6b59e092317c9f4a95316b72e999336.tar.gz
sssd-7e0e2529c6b59e092317c9f4a95316b72e999336.tar.bz2
sssd-7e0e2529c6b59e092317c9f4a95316b72e999336.zip
Style fixes for /common
Diffstat (limited to 'common/trace')
-rw-r--r--common/trace/trace.h75
1 files changed, 42 insertions, 33 deletions
diff --git a/common/trace/trace.h b/common/trace/trace.h
index 58c97936..9211e20d 100644
--- a/common/trace/trace.h
+++ b/common/trace/trace.h
@@ -41,47 +41,56 @@ extern unsigned trace_level;
#ifdef HAVE_TRACE
/* Tracing strings */
-#define TRACE_STRING(level,message,str) if(level & trace_level) \
- printf("[DEBUG] %23s (%4d) %s %s\n",__FILE__,__LINE__,message,str);
-/* Convenience wrappers for strings */
-#define TRACE_FLOW_STRING(message,str) TRACE_STRING(TRACE_FLOW,message,str)
-#define TRACE_ERROR_STRING(message,str) TRACE_STRING(TRACE_ERROR,message,str)
-#define TRACE_INFO_STRING(message,str) TRACE_STRING(TRACE_INFO,message,str)
+#define TRACE_STRING(level, msg, str) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %23s (%4d) %s %s\n", \
+ __FILE__, __LINE__, msg, str); \
+ } \
+ } while(0)
/* Tracing numbers */
-#define TRACE_NUMBER(level,message,number) if(level & trace_level) \
- printf("[DEBUG] %23s (%4d) %s %lu\n",__FILE__,__LINE__,message,(unsigned long int)(number));
-/* Convenience wrappers for numbers */
-#define TRACE_FLOW_NUMBER(message,number) TRACE_NUMBER(TRACE_FLOW,message,number)
-#define TRACE_ERROR_NUMBER(message,number) TRACE_NUMBER(TRACE_ERROR,message,number)
-#define TRACE_INFO_NUMBER(message,number) TRACE_NUMBER(TRACE_INFO,message,number)
+#define TRACE_NUMBER(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %23s (%4d) %s %lu\n", \
+ __FILE__, __LINE__, msg, (unsigned long int)(num)); \
+ } \
+ } while(0)
/* Tracing doubles */
-#define TRACE_DOUBLE(level,message,number) if(level & trace_level) \
- printf("[DEBUG] %23s (%4d) %s %e\n",__FILE__,__LINE__,message,(double)(number));
-/* Convenience wrappers for numbers */
-#define TRACE_FLOW_DOUBLE(message,number) TRACE_DOUBLE(TRACE_FLOW,message,number)
-#define TRACE_ERROR_DOUBLE(message,number) TRACE_DOUBLE(TRACE_ERROR,message,number)
-#define TRACE_INFO_DOUBLE(message,number) TRACE_DOUBLE(TRACE_INFO,message,number)
+#define TRACE_DOUBLE(level, msg, num) \
+ do { \
+ if (level & trace_level) { \
+ printf("[DEBUG] %23s (%4d) %s %e\n", \
+ __FILE__, __LINE__, msg, (double)(num)); \
+ } \
+ } while(0)
/* Assertion */
-#define TRACE_ASSERT(expression) expression ? ; : printf("ASSERTION FAILED\n");
-#else
+#define TRACE_ASSERT(expression) expression ? : printf("ASSERTION FAILED\n")
+#else /* HAVE_TRACE */
+
/* Noop in case the tracing is disabled */
-#define TRACE_STRING(level,message,str) ;
-#define TRACE_NUMBER(level,message,number) ;
-#define TRACE_DOUBLE(level,message,number) ;
-#define TRACE_FLOW_STRING(message,str) ;
-#define TRACE_ERROR_STRING(message,str) ;
-#define TRACE_INFO_STRING(message,str) ;
-#define TRACE_FLOW_NUMBER(message,str) ;
-#define TRACE_ERROR_NUMBER(message,str) ;
-#define TRACE_INFO_NUMBER(message,str) ;
-#define TRACE_FLOW_DOUBLE(message,str) ;
-#define TRACE_ERROR_DOUBLE(message,str) ;
-#define TRACE_INFO_DOUBLE(message,str) ;
-#define TRACE_ASSERT(expression) ;
+#define TRACE_STRING(level, msg, str)
+#define TRACE_NUMBER(level, msg, num)
+#define TRACE_DOUBLE(level, msg, num)
#endif /* HAVE_TRACE */
+/* Convenience wrappers for strings */
+#define TRACE_FLOW_STRING(msg, str) TRACE_STRING(TRACE_FLOW, msg, str)
+#define TRACE_ERROR_STRING(msg, str) TRACE_STRING(TRACE_ERROR, msg, str)
+#define TRACE_INFO_STRING(msg, str) TRACE_STRING(TRACE_INFO, msg, str)
+
+/* Convenience wrappers for numbers */
+#define TRACE_FLOW_NUMBER(msg, num) TRACE_NUMBER(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_NUMBER(msg, num) TRACE_NUMBER(TRACE_ERROR, msg, num)
+#define TRACE_INFO_NUMBER(msg, num) TRACE_NUMBER(TRACE_INFO, msg, num)
+
+/* Convenience wrappers for numbers */
+#define TRACE_FLOW_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_FLOW, msg, num)
+#define TRACE_ERROR_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_ERROR, msg, num)
+#define TRACE_INFO_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_INFO, msg, num)
+
#endif /* COMMON_TRACE_H */