From 3e3770fa820660e370738513238d660b83ff19b0 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 18 Nov 2015 14:46:24 +0200 Subject: [PATCH] ss_dassert() no longer uses skygw_log_write. Use of skygw_log_write() in ss_dassert and ss_info_dassert replaced with the use of MXS_ERROR(). In addition, ss_dassert and ss_info_dassert are now expressions that require a trailing ;. --- server/core/test/testusers.c | 2 +- utils/skygw_debug.h | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/server/core/test/testusers.c b/server/core/test/testusers.c index fcc933b1a..efb0a9c87 100644 --- a/server/core/test/testusers.c +++ b/server/core/test/testusers.c @@ -59,7 +59,7 @@ int result, count; "testusers : Initialise the user table."); users = users_alloc(); mxs_log_flush_sync(); - ss_info_dassert(NULL != users, "Allocating user table should not return NULL.") + ss_info_dassert(NULL != users, "Allocating user table should not return NULL."); ss_dfprintf(stderr, "\t..done\nAdd a user"); count = users_add(users, "username", "authorisation"); mxs_log_flush_sync(); diff --git a/utils/skygw_debug.h b/utils/skygw_debug.h index 359d98cdd..7a4a40de6 100644 --- a/utils/skygw_debug.h +++ b/utils/skygw_debug.h @@ -52,14 +52,12 @@ #if defined(SS_DEBUG) && defined(LOG_ASSERT) #include -# define ss_dassert(exp) if(!(exp)){(skygw_log_write(LE,\ - "debug assert %s:%d\n", \ - (char*)__FILE__, \ - __LINE__));mxs_log_flush_sync();assert(exp);} -#define ss_info_dassert(exp,info) if(!(exp)){(skygw_log_write(LE,\ - "debug assert %s:%d %s\n", \ - (char*)__FILE__, \ - __LINE__,info));mxs_log_flush_sync();assert(exp);} +# define ss_dassert(exp) do { if(!(exp)){\ + MXS_ERROR("debug assert %s:%d\n", (char*)__FILE__, __LINE__);\ + mxs_log_flush_sync(); assert(exp);} } while (false) +#define ss_info_dassert(exp,info) do { if(!(exp)){\ + MXS_ERROR("debug assert %s:%d %s\n", (char*)__FILE__, __LINE__, info);\ + mxs_log_flush_sync();assert(exp);} } while (false) # define ss_debug(exp) exp # define ss_dfprintf fprintf # define ss_dfflush fflush