diff options
author | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2003-12-07 15:34:29 +0000 |
---|---|---|
committer | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2003-12-07 15:34:29 +0000 |
commit | c8fdff20285b59cd892297317572fbb4c3633f78 (patch) | |
tree | 102be6141b635eb2bff16358ca13b79924b211f4 /src/xine-utils/xineutils.h | |
parent | a2dcf860b2777e530646abd00202c3fb5b3a5a81 (diff) | |
download | xine-lib-c8fdff20285b59cd892297317572fbb4c3633f78.tar.gz xine-lib-c8fdff20285b59cd892297317572fbb4c3633f78.tar.bz2 |
get rid of XINE_{ASSERT,ABORT} and useless xine_print_trace (useless). Replace XINE_ASSERT by _x_assert, which works exaclty as assert, except that it still warns with NDEBUG defined (but don't abort). Fix missuning of assert(0), which isn't safe, abort is abort, assert is for debugging purpose only, so all assert(0) has been converted to abort() alls. In osd_preload_fonts(): alloc needed memory chunk. Define NDEBUG in CFLAGS, for non DEBUG build only.
CVS patchset: 5860
CVS date: 2003/12/07 15:34:29
Diffstat (limited to 'src/xine-utils/xineutils.h')
-rw-r--r-- | src/xine-utils/xineutils.h | 74 |
1 files changed, 15 insertions, 59 deletions
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 46aa3d12d..5e4c81f16 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xineutils.h,v 1.70 2003/12/06 18:15:56 mroi Exp $ + * $Id: xineutils.h,v 1.71 2003/12/07 15:34:31 f1rmb Exp $ * */ #ifndef XINEUTILS_H @@ -830,9 +830,6 @@ extern int v_b_table[256]; /* print a hexdump of the given data */ void xine_hexdump (const char *buf, int length); -/* backtrace printout funtion for use in XINE_ASSERT() macro */ -void xine_print_trace(void); - /* * Optimization macros for conditions * Taken from the FIASCO L4 microkernel sources @@ -844,64 +841,23 @@ void xine_print_trace(void); # define EXPECT_TRUE(x) __builtin_expect((x),1) # define EXPECT_FALSE(x) __builtin_expect((x),0) #endif - -#ifdef DEBUG -# define XINE_ABORT() \ - abort(); -#else -# define XINE_ABORT() \ - /* don't abort, but print warning */ \ - printf("%s: OOPS, your player reached a bad state\n", __FILE__); \ - printf("%s: please send a report with the full console output to the xine team.\n", __FILE__); -#endif - -/** - * Provide assert like feature with better description of failure - * Thanks to Mark Thomas - */ -#ifdef __GNUC__ -# define XINE_ASSERT(exp, desc, args...) \ - do { \ - if (!(exp)) { \ - printf("%s:%s:%d: assertion `%s' failed. " desc "\n\n", \ - __FILE__, __XINE_FUNCTION__, __LINE__, #exp, ##args); \ - xine_print_trace(); \ - XINE_ABORT(); \ - } \ - } while(0) -#else /* not GNU C, assume we have a C99 compiler */ - -#ifdef _MSC_VER -/* - #define XINE_ASSERT(exp, desc) ((void)((exp) || \ - (printf desc, _assert(#exp, __FILE__, __LINE__), 0))) - -*/ -# define XINE_ASSERT(exp, desc) \ - do { \ - if (!(exp)) { \ - printf("%s:%s:%d: assertion `%s' failed. ", \ - __FILE__, __XINE_FUNCTION__, __LINE__, #exp); \ - printf(desc); \ - printf("\n\n"); \ - xine_print_trace(); \ - XINE_ABORT(); \ - } \ + +#ifdef NDEBUG +#define _x_assert(exp) \ + do { \ + if (!(exp)) \ + fprintf(stderr, "%s:%s:%d: Assertion `%s' failed.\n", \ + __FILE__, __XINE_FUNCTION__, __LINE__, #exp); \ } while(0) #else -# define XINE_ASSERT(exp, ...) \ - do { \ - if (!(exp)) { \ - printf("%s:%s:%d: assertion `%s' failed. ", \ - __FILE__, __XINE_FUNCTION__, __LINE__, #exp); \ - printf(__VA_ARGS__); \ - printf("\n\n"); \ - xine_print_trace(); \ - XINE_ABORT(); \ - } \ +#define _x_assert(exp) \ + do { \ + if (!(exp)) { \ + fprintf(stderr, "%s:%s:%d: Assertion `%s' failed.\n", \ + __FILE__, __XINE_FUNCTION__, __LINE__, #exp); \ + abort(); \ + } \ } while(0) -#endif /* _MSC_VER */ - #endif /****** logging with xine **********************************/ |