wmail: handle allocation failures.
[dockapps.git] / wmcliphist / debug.h
blobb830000e2d76ced3d7f53f392173c2d4f9336b85
1 #ifndef _DEBUG_H_
2 #define _DEBUG_H_
5 #ifdef DBG_THREADS
6 #define debug_init() debug_init_threads()
7 #else
8 #define debug_init() debug_init_nothreads()
9 #endif
12 void
13 debug_init_threads();
15 void
16 debug_init_nothreads();
19 void
20 fn_begin(char *format, ...);
22 void
23 fn_end();
26 #ifdef FNCALL_DEBUG
27 /* define macros with debugging on */
29 #define begin_func(_format, _args...) fn_begin(_format , ##_args)
31 #define return_val(_value) \
32 do { \
33 fn_end(); \
34 return _value; \
35 } while (0)
37 #define return_void() \
38 do { \
39 fn_end(); \
40 return; \
41 } while (0)
43 #else
44 /* define macros with debugging off */
46 #define begin_func(_format)
48 #define return_val(_value) return _value
50 #define return_void() return
52 #endif
55 #endif