# HG changeset patch # User zas_ # Date 1208993713 0 # Node ID 2c6558663b52abe55875be80e1a46d300de81368 # Parent 1bac19d5a66363fb54a86c7a5acdcdcfe005d2dc Display file and line along debug messages for any debug level but level 1. Add a DEBUG_0() macro for instant debugging. diff -r 1bac19d5a663 -r 2c6558663b52 src/main.h --- a/src/main.h Wed Apr 23 22:40:55 2008 +0000 +++ b/src/main.h Wed Apr 23 23:35:13 2008 +0000 @@ -120,11 +120,19 @@ #endif #ifdef DEBUG -#define DEBUG_N(n, ...) do { if (debug >= (n)) printf(__VA_ARGS__); } while (0) +#define DEBUG_N(n, ...) do \ + { \ + if (debug >= (n)) \ + { \ + if (debug != 1) printf("%s:%d: ", __FILE__, __LINE__); \ + printf(__VA_ARGS__); \ + } \ + } while (0) #else #define DEBUG_N(n, ...) do { } while(0) #endif +#define DEBUG_0(...) DEBUG_N(0, __VA_ARGS__) #define DEBUG_1(...) DEBUG_N(1, __VA_ARGS__) #define DEBUG_2(...) DEBUG_N(2, __VA_ARGS__) #define DEBUG_3(...) DEBUG_N(3, __VA_ARGS__)