summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Ørbekk <orbekk@pvv.ntnu.no>2008-09-07 18:10:36 +0200
committerKjetil Ørbekk <orbekk@pvv.ntnu.no>2008-09-07 18:10:36 +0200
commit65c4534198b928113481eaef5c2de3e5b3d8cf7e (patch)
treea893f1ff67c993e2f7ff05a3ceed347345073c57
parentc74bd922870214c48ac5d032f13b0751ef32be59 (diff)
- Debug to stderr instead of debug.txt
-rw-r--r--include/debug.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/include/debug.h b/include/debug.h
index 350a27e..18c891e 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -23,17 +23,15 @@
#ifdef DEBUGGING
+# include <stdlib.h>
# include <stdio.h>
# define DEBUGPATH "debug.txt"
extern pthread_mutex_t __debug_lock__;
-FILE *__debug_handle__;
# define DEBUG(...) do { \
- pthread_mutex_lock(&__debug_lock__); \
- __debug_handle__ = fopen(DEBUGPATH, "a"); \
- fprintf (__debug_handle__, __VA_ARGS__); \
- fclose(__debug_handle__); \
- pthread_mutex_unlock(&__debug_lock__); \
- } while (0)
+ pthread_mutex_lock(&__debug_lock__); \
+ fprintf (stderr, __VA_ARGS__); \
+ pthread_mutex_unlock(&__debug_lock__); \
+ } while (0)
#else
# define DEBUG(...)
#endif