From 3a634a273a7bff3d219883f572db786e2c1004b1 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 21 Feb 2007 19:03:20 +0000 Subject: curlassert macro replaced with DEBUGASSERT macro defined in setup_once.h --- ares/ares_strerror.c | 2 +- ares/setup_once.h | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'ares') diff --git a/ares/ares_strerror.c b/ares/ares_strerror.c index 28d2e0bf1..3486ebfbb 100644 --- a/ares/ares_strerror.c +++ b/ares/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/ares/setup_once.h b/ares/setup_once.h index 32d8293ee..20ea3819d 100644 --- a/ares/setup_once.h +++ b/ares/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 -- cgit v1.2.3