aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-15 12:27:28 +0200
committerMax Kellermann <max@duempel.org>2008-09-15 12:27:28 +0200
commit4ebba1b36f4f171fb5daa25a8578e21d2740c517 (patch)
treed65b86318939ce111bf855539aa4d1b3e2bc581b
parent7d98fb19dc2b7c3af289b0a7c1a0db68e7fea8c9 (diff)
downloadmpd-4ebba1b36f4f171fb5daa25a8578e21d2740c517.tar.gz
mpd-4ebba1b36f4f171fb5daa25a8578e21d2740c517.tar.xz
mpd-4ebba1b36f4f171fb5daa25a8578e21d2740c517.zip
use !NDEBUG instead of DEBUG
NDEBUG is more commonly used than DEBUG, e.g. in assert.h. Convert all macros to NDEBUG, and declare NDEBUG when debugging is disabled.
-rw-r--r--configure.ac4
-rw-r--r--src/main.c2
-rw-r--r--src/mpdclient.c4
-rw-r--r--src/ncmpc.h2
-rw-r--r--src/options.c6
5 files changed, 10 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 16a13571d..dc6a41351 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,7 +206,9 @@ AC_ARG_ENABLE([debug],
[enable_debug=no])
AC_MSG_RESULT([$enable_debug])
if test "x$enable_debug" = "xyes" ; then
- CFLAGS="$CFLAGS -g -DDEBUG"
+ CFLAGS="$CFLAGS -g"
+else
+ CFLAGS="$CFLAGS -DNDEBUG"
fi
dnl CFLAGS
diff --git a/src/main.c b/src/main.c
index c2c7170eb..1d93b69fc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -154,7 +154,7 @@ sigstop(void)
kill(0, SIGSTOP); /* issue SIGSTOP */
}
-#ifdef DEBUG
+#ifndef NDEBUG
void
D(char *format, ...)
{
diff --git a/src/mpdclient.c b/src/mpdclient.c
index cc31f9ca5..9f060c46d 100644
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
@@ -115,7 +115,7 @@ error_cb(mpdclient_t *c, gint error, gchar *msg)
return error;
}
-#ifdef DEBUG
+#ifndef NDEBUG
// Unused ath the moment
/*
#include "strfsong.h"
@@ -246,7 +246,7 @@ mpdclient_update(mpdclient_t *c)
c->status = mpd_getStatus(c->connection);
if( (retval=mpdclient_finish_command(c)) )
return retval;
-#ifdef DEBUG
+#ifndef NDEBUG
if( c->status->error )
D("status> %s\n", c->status->error);
#endif
diff --git a/src/ncmpc.h b/src/ncmpc.h
index 7d000958d..033145f91 100644
--- a/src/ncmpc.h
+++ b/src/ncmpc.h
@@ -21,7 +21,7 @@
#define ENABLE_LYRICS_SCREEN 1
#endif
-#ifdef DEBUG
+#ifndef NDEBUG
void D(char *format, ...);
#else
#define D(...)
diff --git a/src/options.c b/src/options.c
index 60101c478..1ecc79103 100644
--- a/src/options.c
+++ b/src/options.c
@@ -67,7 +67,7 @@ static arg_opt_t option_table[] = {
{ 'f', "config", "FILE", "Read configuration from file" },
{ 'k', "key-file","FILE", "Read configuration from file" },
{ 'S', "no-splash", NULL, "Don't show the splash screen" },
-#ifdef DEBUG
+#ifndef NDEBUG
{ 'K', "dump-keys", NULL, "Dump key bindings to stdout" },
{ 'D', "debug", NULL, "Enable debug output on stderr" },
#endif
@@ -152,7 +152,7 @@ handle_option(int c, char *arg)
case 'V': /* --version */
printf("%s version: %s\n", PACKAGE, VERSION);
printf("build options:");
-#ifdef DEBUG
+#ifndef NDEBUG
printf(" debug");
#endif
#ifdef ENABLE_NLS
@@ -216,7 +216,7 @@ handle_option(int c, char *arg)
case 'S': /* --key-file */
/* the splash screen was removed */
break;
-#ifdef DEBUG
+#ifndef NDEBUG
case 'K': /* --dump-keys */
read_configuration(&options);
write_key_bindings(stdout, KEYDEF_WRITE_ALL | KEYDEF_COMMENT_ALL);