diff options
Diffstat (limited to 'src/xine-utils')
| -rw-r--r-- | src/xine-utils/attributes.h | 6 | ||||
| -rw-r--r-- | src/xine-utils/xine_check.c | 2 | ||||
| -rw-r--r-- | src/xine-utils/xineutils.h | 43 |
3 files changed, 49 insertions, 2 deletions
diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index e7e48d5af..2179823c8 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -21,6 +21,9 @@ /* use gcc attribs to align critical data structures */ +#ifndef ATTRIBUTE_H_ +#define ATTRIBUTE_H_ + #ifdef ATTRIBUTE_ALIGNED_MAX #define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align))) #else @@ -36,3 +39,6 @@ #undef ATTRIBUTE_PACKED #define __attribute__(x) /**/ #endif + +#endif /* ATTRIBUTE_H_ */ + diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c index 88b6bff79..33519c342 100644 --- a/src/xine-utils/xine_check.c +++ b/src/xine-utils/xine_check.c @@ -84,7 +84,7 @@ static void set_hc_result(xine_health_check_t* hc, int state, char *format, ...) size = strlen(format) + 1; if ((buf = malloc(size)) == NULL) { - printf ("xine_heck: GASP, malloc() failed\n"); + printf ("xine_check: GASP, malloc() failed\n"); abort(); } diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 0656a5f1f..d1e2d1981 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.33 2003/02/02 06:07:20 tmmm Exp $ + * $Id: xineutils.h,v 1.34 2003/02/28 02:51:52 storri Exp $ * */ #ifndef XINEUTILS_H @@ -30,12 +30,19 @@ extern "C" { #include <unistd.h> #include <stdlib.h> #include <string.h> +#include <stdarg.h> #include <inttypes.h> #include <pthread.h> #include "attributes.h" #include "compat.h" #include "xmlparser.h" #include "xine_buffer.h" +#include "configfile.h" +#include "config.h" + +#include <stdio.h> +#include <string.h> +#include <execinfo.h> #ifdef __SUNPRO_C #define inline @@ -784,6 +791,40 @@ extern int v_g_table[256]; extern int v_b_table[256]; + /* Code Taken from GNU C Library manual */ +/* Obtain a backtrace and print it to stdout. */ +static void +print_trace (void) +{ + void *array[10]; + size_t size; + char **strings; + size_t i; + + size = backtrace (array, 10); + strings = backtrace_symbols (array, size); + + printf ("Obtained %zd stack frames.\n", size); + + for (i = 0; i < size; i++) { + printf ("%s\n", strings[i]); + } + free (strings); +} + +/** + * Provide assert like feature with better description of failure + * Thanks to Mark Thomas + */ +#define XINE_ASSERT(exp, desc, args...) \ + if (!(exp)) { \ + printf("%s:%s:%d: assertion `" #exp "' failed. " desc "\n\n", \ + __FILE__, __FUNCTION__, __LINE__, ##args); \ + print_trace(); \ + abort(); \ + } + + /******** double chained lists with builtin iterator *******/ typedef struct xine_node_s { |
