diff options
Diffstat (limited to 'src/xine-utils')
-rw-r--r-- | src/xine-utils/utils.c | 28 | ||||
-rw-r--r-- | src/xine-utils/xineutils.h | 74 |
2 files changed, 16 insertions, 86 deletions
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 3e7ec7f6b..b351ac860 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -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: utils.c,v 1.21 2003/12/06 16:10:01 miguelfreitas Exp $ + * $Id: utils.c,v 1.22 2003/12/07 15:34:31 f1rmb Exp $ * */ #define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */ @@ -142,32 +142,6 @@ void xine_usec_sleep(unsigned usec) { #endif } - -/* Obtain a backtrace and print it to stdout. */ -void xine_print_trace (void) { -#if HAVE_BACKTRACE - /* Code Taken from GNU C Library manual */ - void *array[10]; - size_t size; - char **strings; - size_t i; - - size = backtrace (array, 10); - strings = backtrace_symbols (array, size); - - printf ("Obtained %lu stack frames.\n", (unsigned long) size); - - for (i = 0; i < size; i++) { - printf ("%s\n", strings[i]); - } - free (strings); -#elif HAVE_PRINTSTACK - printstack(STDOUT_FILENO); -#else - printf("stack backtrace not available.\n"); -#endif -} - /* print a hexdump of length bytes from the data given in buf */ void xine_hexdump (const char *buf, int length) { int i,j; 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 **********************************/ |