From 45a372ac3d32d0cb10b11409db0c785ea8855f05 Mon Sep 17 00:00:00 2001 From: beveloper Date: Sun, 7 Sep 2003 22:28:42 +0000 Subject: [PATCH] enable debugging functions only when DEBUG defined git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4537 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/audio/ac97/ich/debug.c | 17 ++++++----------- .../kernel/drivers/audio/ac97/ich/debug.h | 3 ++- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/add-ons/kernel/drivers/audio/ac97/ich/debug.c b/src/add-ons/kernel/drivers/audio/ac97/ich/debug.c index ea023c4a21..4d1ae3575a 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/ich/debug.c +++ b/src/add-ons/kernel/drivers/audio/ac97/ich/debug.c @@ -33,13 +33,6 @@ #include "debug.h" #include "ich.h" -static const char * logfile="/boot/home/ich_ac97.log"; -static sem_id loglock; - -void debug_printf(const char *text,...); -void log_printf(const char *text,...); -void log_create(); - void debug_printf(const char *text,...) { char buf[1024]; @@ -52,20 +45,22 @@ void debug_printf(const char *text,...) dprintf(DRIVER_NAME ": %s",buf); } +#if DEBUG > 0 + +static const char * logfile="/boot/home/ich_ac97.log"; +static sem_id loglock; + void log_create() { -#if DEBUG > 0 int fd = open(logfile, O_WRONLY | O_CREAT | O_TRUNC, 0666); const char *text = DRIVER_NAME ", " VERSION "\n"; loglock = create_sem(1,"logfile sem"); write(fd,text,strlen(text)); close(fd); -#endif } void log_printf(const char *text,...) { -#if DEBUG > 0 int fd; char buf[1024]; va_list ap; @@ -85,6 +80,6 @@ void log_printf(const char *text,...) #if DEBUG > 1 snooze(150000); #endif -#endif } +#endif diff --git a/src/add-ons/kernel/drivers/audio/ac97/ich/debug.h b/src/add-ons/kernel/drivers/audio/ac97/ich/debug.h index 0922b726ca..564ab0acba 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/ich/debug.h +++ b/src/add-ons/kernel/drivers/audio/ac97/ich/debug.h @@ -46,6 +46,8 @@ #undef TRACE #undef ASSERT +void debug_printf(const char *text,...); + #if DEBUG > 0 #define PRINT(a) log_printf a #define TRACE(a) debug_printf a @@ -54,7 +56,6 @@ #define ASSERT(a) if (a) {} else LOG(("ASSERT failed! file = %s, line = %d\n",__FILE__,__LINE__)) void log_create(); void log_printf(const char *text,...); - void debug_printf(const char *text,...); #else #define PRINT(a) debug_printf a #define TRACE(a) ((void)(0))