summaryrefslogtreecommitdiff
path: root/src/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug.h')
-rw-r--r--src/debug.h90
1 files changed, 20 insertions, 70 deletions
diff --git a/src/debug.h b/src/debug.h
index 3585cd7..0ff1447 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -1,6 +1,7 @@
/* debug.h
Copyright (C) 1999-2003 Tom Gilbert.
+Copyright (C) 2010-2020 Birte Kristina Friesel.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -26,8 +27,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef DEBUG_H
#define DEBUG_H
-/* #define DEBUG */
-
#ifdef WITH_DMALLOC
#include <dmalloc.h>
#define emalloc(a) malloc(a)
@@ -41,75 +40,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef DEBUG
#ifdef __GNUC__
-#define D(i, a) \
-{ \
- if(i <= opt.debug_level) \
- { \
- printf("%s +%u %s() %s ",__FILE__,__LINE__,__FUNCTION__, stroflen(' ', call_level)); \
- printf a; \
- fflush(stdout); \
- } \
- }
-#define D_ENTER(i) \
- { \
- call_level++; \
- if(i <= opt.debug_level) \
- { \
- printf("%s +%u %s() %s ENTER\n",__FILE__,__LINE__,__FUNCTION__, stroflen('>', call_level)); \
- fflush(stdout); \
- } \
- }
-#define D_RETURN(i, a) \
+#define D(a) \
{ \
- if(i <= opt.debug_level) \
- { \
- printf("%s +%u %s() %s LEAVE\n",__FILE__,__LINE__,__FUNCTION__, stroflen('<', call_level)); \
- fflush(stdout); \
- } \
- call_level--; \
- return (a); \
+ if (opt.debug) { \
+ printf("%-12s +%-4u %-20s : ",__FILE__,__LINE__,__FUNCTION__); \
+ printf a; \
+ fflush(stdout); \
+ } \
}
-#define D_RETURN_(i) \
+#else /* __GNUC__ */
+#define D(a) \
{ \
- if(i <= opt.debug_level) \
- { \
- printf("%s +%u %s() %s LEAVE\n",__FILE__,__LINE__,__FUNCTION__, stroflen('<', call_level)); \
- fflush(stdout); \
- } \
- call_level--; \
- return; \
- }
-#else
-#define D(i, a) \
-{ \
- if(i <= opt.debug_level) \
- { \
- printf("%s +%u : ",__FILE__,__LINE__); \
- printf a; \
- } \
- fflush(stdout); \
- }
-#define D_ENTER(a)
-#define D_RETURN(i, a) \
- { \
- return(a); \
- }
-#define D_RETURN_(i) \
- { \
- return; \
- }
-#endif
-#else
-#define D(i,a)
-#define D_ENTER(a)
-#define D_RETURN(i, a) \
- { \
- return (a); \
- }
-#define D_RETURN_(i) \
- { \
- return; \
- }
-#endif
+ if (opt.debug) { \
+ printf("%-12s +%-4u : ",__FILE__,__LINE__); \
+ printf a; \
+ fflush(stdout); \
+ } \
+}
+#endif /* __GNUC__ */
+#else /* DEBUG */
+#define D(a)
+#endif /* DEBUG */
-#endif
+#endif /* DEBUG_H */