From 5f5a8ca90580d8fb12f7c3a843ce5a203942dab5 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 21 Feb 2007 19:03:20 +0000 Subject: [PATCH] curlassert macro replaced with DEBUGASSERT macro defined in setup_once.h --- ares_strerror.c | 2 +- setup_once.h | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ares_strerror.c b/ares_strerror.c index 28d2e0bf..3486ebfb 100644 --- a/ares_strerror.c +++ b/ares_strerror.c @@ -46,6 +46,6 @@ const char *ares_strerror(int code) "Illegal hints flags specified" }; - assert(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))); + DEBUGASSERT(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))); return errtext[code]; } diff --git a/setup_once.h b/setup_once.h index 32d8293e..20ea3819 100644 --- a/setup_once.h +++ b/setup_once.h @@ -200,9 +200,20 @@ typedef int sig_atomic_t; */ #ifdef CURLDEBUG -#define DEBUGF(X) X +#define DEBUGF(x) x #else -#define DEBUGF(X) do { } while (0) +#define DEBUGF(x) do { } while (0) +#endif + + +/* + * Macro used to include assertion code only in debug builds. + */ + +#if defined(CURLDEBUG) && defined(HAVE_ASSERT_H) +#define DEBUGASSERT(x) assert(x) +#else +#define DEBUGASSERT(x) do { } while (0) #endif