diff options
author | beber <beber> | 2005-12-07 00:36:35 +0000 |
---|---|---|
committer | beber <beber> | 2005-12-07 00:36:35 +0000 |
commit | cfa7d8ca36d9dfa5608f04999f9bbdd778102d2a (patch) | |
tree | 85b49afaa2d476f32e2650c4b44ccb05c3fa7838 /src/espik_debug.c | |
parent | make it compile (diff) | |
download | espik-cfa7d8ca36d9dfa5608f04999f9bbdd778102d2a.tar.xz |
Avoid warning
Make macro debug work (after compile :p)
Format macro debug outpout (file.c+ligne @file.c: 'message')
Start to use this macro
#if -> #ifdeF
del old macro code
move macro to .h instead of .c while it's not an inline and use everywhere
Diffstat (limited to 'src/espik_debug.c')
-rw-r--r-- | src/espik_debug.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/src/espik_debug.c b/src/espik_debug.c index d072890..11b3188 100644 --- a/src/espik_debug.c +++ b/src/espik_debug.c @@ -1,7 +1,6 @@ #include <unistd.h> #include <stdio.h> #include <stdlib.h> -#include <sys/varargs.h> #include "espik_debug.h" @@ -9,47 +8,16 @@ # include <execinfo.h> #endif /* __GLIBC__ */ -#if _ESPIK_DEBUG_ +#ifdef _ESPIK_DEBUG_ # include <signal.h> #endif /* _ESPIK_DEBUG_ */ -static int indent_level = 0; - -void espik_debug_print (char *fct, ...) -{ -#if _ESPIK_DEBUG_ - va_list ap; - char c, *s; - int d; - - va_start (ap, fct); - while (*fct) - { - fprintf (stderr, ">fct : %c\n", *(fct+1)); - switch (*fct++) - { - case 's': s = va_arg (ap, char*); - fprintf (stderr, "%s", s); - break; - case 'd': d = va_arg (ap, int); - fprintf (stderr, "%d", d); - break; - case 'c': c = va_arg (ap, char); - fprintf (stderr, "%c", c); - break; - default : fprintf (stderr, "Unknown type : %c\n", *fct); - } - fprintf (stderr, "<fct : %c\n", *fct); - } - - va_end (ap); -#endif -} +//static int indent_level = 0; inline void espik_debug_bt (int num) { #ifdef __GLIBC__ -# if _ESPIK_DEBUG_ +# ifdef _ESPIK_DEBUG_ void* array[128]; size_t size; @@ -77,14 +45,14 @@ inline void espik_debug_bt (int num) void espik_debug_init() { -#if _ESPIK_DEBUG_ +#ifdef _ESPIK_DEBUG_ struct sigaction sa; sa.sa_handler = espik_debug_bt; sigaction(SIGSEGV, &sa, (struct sigaction *)0); sigaction(SIGINT, &sa, (struct sigaction *)0); sigaction(SIGKILL, &sa, (struct sigaction *)0); -#endif +#endif /* _ESPIK_DEBUG_ */ } void kill_me (short num) |