From 2aedaabd2dfc87ae2eec2f42100bb66699b6877d Mon Sep 17 00:00:00 2001 From: phintuka Date: Mon, 23 Oct 2006 19:22:14 +0000 Subject: ASSERT --- logdefs.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/logdefs.h b/logdefs.h index 28e754b3..1cdcb501 100644 --- a/logdefs.h +++ b/logdefs.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: logdefs.h,v 1.3 2006-09-06 17:59:34 phintuka Exp $ + * $Id: logdefs.h,v 1.4 2006-10-23 19:22:14 phintuka Exp $ * */ @@ -57,6 +57,21 @@ #define LOGDBG(x...) do{ if(SysLogLevel > 2) x_syslog(LOG_DEBUG, x); } while(0) +#ifdef NDEBUG +# define ASSERT(expr) +#else +# define ASSERT(expr,fatal) \ + do { \ + if(!(expr)) { \ + LOGERR("Asseretion failed: %s at %s:%d (%s)", \ + #expr, __FILE__, __LINE__, __FUNCTION__); \ + if(fatal) \ + abort(); \ + } \ + } while(0) +#endif + + #ifdef XINELIBOUTPUT_DEBUG # ifdef __cplusplus # -- cgit v1.2.3