summaryrefslogtreecommitdiff
path: root/src/xine-utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-utils')
-rw-r--r--src/xine-utils/memcpy.c39
-rw-r--r--src/xine-utils/xine_buffer.c4
-rw-r--r--src/xine-utils/xine_check.c4
-rw-r--r--src/xine-utils/xineutils.h110
-rw-r--r--src/xine-utils/xmllexer.c12
-rw-r--r--src/xine-utils/xmlparser.c27
6 files changed, 105 insertions, 91 deletions
diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c
index ca6c4444a..a75904fce 100644
--- a/src/xine-utils/memcpy.c
+++ b/src/xine-utils/memcpy.c
@@ -435,10 +435,10 @@ static uint64_t rdtsc(int config_flags)
}
#endif
-static void update_fast_memcpy(void *this_gen, xine_cfg_entry_t *entry) {
- static int config_flags = -1;
-
- int method;
+static void update_fast_memcpy(void *user_data, xine_cfg_entry_t *entry) {
+ static int config_flags = -1;
+ xine_t *xine = (xine_t *) user_data;
+ int method;
config_flags = xine_mm_accel();
@@ -451,19 +451,18 @@ static void update_fast_memcpy(void *this_gen, xine_cfg_entry_t *entry) {
xine_fast_memcpy = memcpy_method[method].function;
return;
} else {
- printf("xine: will probe memcpy on startup\n" );
+ xprintf(xine, XINE_VERBOSITY_DEBUG, "xine: will probe memcpy on startup\n" );
}
}
#define BUFSIZE 1024*1024
-void xine_probe_fast_memcpy(config_values_t *config)
+void xine_probe_fast_memcpy(xine_t *xine)
{
- uint64_t t;
-
- char *buf1, *buf2;
- int i, j, best;
- int config_flags = -1;
- static char *memcpy_methods[] = {
+ uint64_t t;
+ char *buf1, *buf2;
+ int i, j, best;
+ int config_flags = -1;
+ static char *memcpy_methods[] = {
"probe", "glibc",
#if defined(ARCH_X86) && !defined(_MSC_VER)
"kernel", "mmx", "mmxext", "sse",
@@ -473,13 +472,13 @@ void xine_probe_fast_memcpy(config_values_t *config)
#endif
NULL
};
-
+
config_flags = xine_mm_accel();
- best = config->register_enum (config, "misc.memcpy_method", 0,
- memcpy_methods,
- _("Memcopy method to use in xine for large data chunks."),
- NULL, 20, update_fast_memcpy, NULL);
+ best = xine->config->register_enum (xine->config, "misc.memcpy_method", 0,
+ memcpy_methods,
+ _("Memcopy method to use in xine for large data chunks."),
+ NULL, 20, update_fast_memcpy, (void *) xine);
/* check if function is configured and valid for this machine */
if( best != 0 &&
@@ -502,7 +501,7 @@ void xine_probe_fast_memcpy(config_values_t *config)
return;
}
- printf("Benchmarking memcpy methods (smaller is better):\n");
+ xprintf(xine, XINE_VERBOSITY_LOG, _("Benchmarking memcpy methods (smaller is better):\n"));
/* make sure buffers are present on physical memory */
memset(buf1,0,BUFSIZE);
memset(buf2,0,BUFSIZE);
@@ -522,13 +521,13 @@ void xine_probe_fast_memcpy(config_values_t *config)
t = rdtsc(config_flags) - t;
memcpy_method[i].time = t;
- printf("\t%s : %lld\n",memcpy_method[i].name, t);
+ xprintf(xine, XINE_VERBOSITY_LOG, "\t%s : %lld\n", memcpy_method[i].name, t);
if( best == 0 || t < memcpy_method[best].time )
best = i;
}
- config->update_num (config, "misc.memcpy_method", best);
+ xine->config->update_num (xine->config, "misc.memcpy_method", best);
free(buf1);
free(buf2);
diff --git a/src/xine-utils/xine_buffer.c b/src/xine-utils/xine_buffer.c
index 42623895b..d99adbc49 100644
--- a/src/xine-utils/xine_buffer.c
+++ b/src/xine-utils/xine_buffer.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: xine_buffer.c,v 1.5 2003/11/26 19:43:38 f1rmb Exp $
+ * $Id: xine_buffer.c,v 1.6 2003/12/05 15:55:05 f1rmb Exp $
*
*
* generic dynamic buffer functions. The goals
@@ -211,7 +211,7 @@ void xine_buffer_copyout(void *buf, int index, void *data, int len) {
if (GET_HEADER(buf)->size < index+len)
{
- printf("xine_buffer_copyout: warning: attempt to read over boundary!\n");
+ lprintf("xine_buffer_copyout: warning: attempt to read over boundary!\n");
if (GET_HEADER(buf)->size < index)
return;
len = GET_HEADER(buf)->size - index;
diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c
index ccd3a6424..e4ddb4622 100644
--- a/src/xine-utils/xine_check.c
+++ b/src/xine-utils/xine_check.c
@@ -82,10 +82,8 @@ 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_check: GASP, malloc() failed\n");
+ if (!(buf = xine_xmalloc(size)))
abort();
- }
while(1) {
va_start(args, format);
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index 313e23fc4..989a4b9cb 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.67 2003/12/04 22:15:26 jstembridge Exp $
+ * $Id: xineutils.h,v 1.68 2003/12/05 15:55:05 f1rmb Exp $
*
*/
#ifndef XINEUTILS_H
@@ -596,7 +596,7 @@ extern void *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
#ifdef HAVE_XINE_INTERNAL_H
/* Benchmark available memcpy methods */
-void xine_probe_fast_memcpy(config_values_t *config);
+void xine_probe_fast_memcpy(xine_t *xine);
#endif
@@ -902,80 +902,98 @@ void xine_print_trace(void);
#define LOG_MODULE_STRING printf("%s: ", LOG_MODULE );
#ifdef LOG_VERBOSE
- #define LONG_LOG_MODULE_STRING \
+ #define LONG_LOG_MODULE_STRING \
printf("%s: (%s:%d) ", LOG_MODULE, __XINE_FUNCTION__, __LINE__ );
#else
#define LONG_LOG_MODULE_STRING LOG_MODULE_STRING
#endif /* LOG_VERBOSE */
#ifdef LOG
- #define lprintf \
- LONG_LOG_MODULE_STRING \
- printf
-#else
#ifdef __GNUC__
- #define lprintf(fmt, args...) ;
+ #define lprintf(fmt, args...) \
+ do { \
+ LONG_LOG_MODULE_STRING \
+ printf(fmt, ##args); \
+ } while(0)
+ #else /* __GNUC__ */
+ #ifdef _MSC_VER
+ #define lprintf(fmtargs) \
+ do { \
+ LONG_LOG_MODULE_STRING \
+ printf("%s", fmtargs); \
+ } while(0)
+ #else /* _MSC_VER */
+ #define lprintf(fmt, ...) \
+ do { \
+ LONG_LOG_MODULE_STRING \
+ printf(__VA_ARGS__); \
+ } while(0)
+ #endif /* _MSC_VER */
+ #endif /* __GNUC__ */
+#else /* LOG */
+ #ifdef __GNUC__
+ #define lprintf(fmt, args...) do {} while(0)
#else
#ifdef _MSC_VER
- #define lprintf
+ #define lprintf do {} while(0)
#else
- #define lprintf(...) ;
+ #define lprintf(...) do {} while(0)
#endif /* _MSC_VER */
#endif /* __GNUC__ */
#endif /* LOG */
#ifdef __GNUC__
- #define llprintf(cat, fmt, args...) \
- do{ \
- if(cat){ \
- LONG_LOG_MODULE_STRING \
- printf( fmt, ##args ); \
- } \
+ #define llprintf(cat, fmt, args...) \
+ do{ \
+ if(cat){ \
+ LONG_LOG_MODULE_STRING \
+ printf( fmt, ##args ); \
+ } \
}while(0)
#else
#ifdef _MSC_VER
- #define llprintf(cat, fmtargs) \
- do{ \
- if(cat){ \
- LONG_LOG_MODULE_STRING \
- printf( "%s", fmtargs ); \
- } \
+ #define llprintf(cat, fmtargs) \
+ do{ \
+ if(cat){ \
+ LONG_LOG_MODULE_STRING \
+ printf( "%s", fmtargs ); \
+ } \
}while(0)
#else
- #define llprintf(cat, ...) \
- do{ \
- if(cat){ \
- LONG_LOG_MODULE_STRING \
- printf( __VA_ARGS__ ); \
- } \
+ #define llprintf(cat, ...) \
+ do{ \
+ if(cat){ \
+ LONG_LOG_MODULE_STRING \
+ printf( __VA_ARGS__ ); \
+ } \
}while(0)
#endif /* _MSC_VER */
#endif /* __GNUC__ */
#ifdef __GNUC__
- #define xprintf(xine, verbose, fmt, args...) \
- do { \
- if((xine)->verbosity >= verbose){ \
- LOG_MODULE_STRING \
- xine_log(xine, XINE_LOG_TRACE, fmt, ##args); \
- } \
+ #define xprintf(xine, verbose, fmt, args...) \
+ do { \
+ if((xine)->verbosity >= verbose){ \
+ LOG_MODULE_STRING \
+ xine_log(xine, XINE_LOG_TRACE, fmt, ##args); \
+ } \
} while(0)
#else
#ifdef _MSC_VER
- #define xprintf(xine, verbose, fmtargs) \
- do { \
- if((xine)->verbosity >= verbose){ \
- LOG_MODULE_STRING \
- xine_log(xine, XINE_LOG_TRACE, fmtargs); \
- } \
+ #define xprintf(xine, verbose, fmtargs) \
+ do { \
+ if((xine)->verbosity >= verbose){ \
+ LOG_MODULE_STRING \
+ xine_log(xine, XINE_LOG_TRACE, fmtargs); \
+ } \
} while(0)
#else
- #define xprintf(xine, verbose, ...) \
- do { \
- if((xine)->verbosity >= verbose){ \
- LOG_MODULE_STRING \
- xine_log(xine, XINE_LOG_TRACE, __VA_ARGS__); \
- } \
+ #define xprintf(xine, verbose, ...) \
+ do { \
+ if((xine)->verbosity >= verbose){ \
+ LOG_MODULE_STRING \
+ xine_log(xine, XINE_LOG_TRACE, __VA_ARGS__); \
+ } \
} while(0)
#endif /* _MSC_VER */
#endif /* __GNUC__ */
diff --git a/src/xine-utils/xmllexer.c b/src/xine-utils/xmllexer.c
index e99ac692d..f41dbbdc6 100644
--- a/src/xine-utils/xmllexer.c
+++ b/src/xine-utils/xmllexer.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: xmllexer.c,v 1.4 2003/11/26 19:43:38 f1rmb Exp $
+ * $Id: xmllexer.c,v 1.5 2003/12/05 15:55:05 f1rmb Exp $
*
*/
@@ -347,7 +347,7 @@ int lexer_get_token(char * tok, int tok_size) {
}
break;
default:
- printf("xmllexer: expected char \'%c\'\n", tok[tok_pos - 1]); /* FIX ME */
+ lprintf("xmllexer: expected char \'%c\'\n", tok[tok_pos - 1]); /* FIX ME */
return T_ERROR;
}
} else {
@@ -368,7 +368,7 @@ int lexer_get_token(char * tok, int tok_size) {
/* pb */
if (tok_pos >= tok_size) {
- printf("xmllexer: token buffer is too little\n");
+ lprintf("xmllexer: token buffer is too little\n");
} else {
if (lexbuf_pos >= lexbuf_size) {
/* Terminate the current token */
@@ -398,15 +398,15 @@ int lexer_get_token(char * tok, int tok_size) {
return T_DATA;
break;
default:
- printf("xmllexer: unknown state, state=%d\n", state);
+ lprintf("xmllexer: unknown state, state=%d\n", state);
}
} else {
- printf("xmllexer: abnormal end of buffer, state=%d\n", state);
+ lprintf("xmllexer: abnormal end of buffer, state=%d\n", state);
}
}
return T_ERROR;
}
/* tok == null */
- printf("xmllexer: token buffer is null\n");
+ lprintf("xmllexer: token buffer is null\n");
return T_ERROR;
}
diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c
index e7a06f65d..b232a1931 100644
--- a/src/xine-utils/xmlparser.c
+++ b/src/xine-utils/xmlparser.c
@@ -18,7 +18,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: xmlparser.c,v 1.11 2003/11/26 19:43:38 f1rmb Exp $
+ * $Id: xmlparser.c,v 1.12 2003/12/05 15:55:05 f1rmb Exp $
*
*/
@@ -209,7 +209,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r
lprintf("info: node data : %s\n", current_node->data);
break;
default:
- printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
+ lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
return -1;
break;
}
@@ -230,7 +230,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r
lprintf("info: current node name \"%s\"\n", node_name);
break;
default:
- printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
+ lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
return -1;
break;
}
@@ -296,7 +296,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r
lprintf("info: current property name \"%s\"\n", property_name);
break;
default:
- printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
+ lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
return -1;
break;
}
@@ -312,12 +312,12 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r
if (strcmp(tok, root_name) == 0) {
state = 4;
} else {
- printf("xmlparser: error: xml struct, tok=%s, waited_tok=%s\n", tok, root_name);
+ lprintf("xmlparser: error: xml struct, tok=%s, waited_tok=%s\n", tok, root_name);
return -1;
}
break;
default:
- printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
+ lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
return -1;
break;
}
@@ -330,7 +330,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r
return 0;
break;
default:
- printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
+ lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
return -1;
break;
}
@@ -365,7 +365,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r
state = 2;
break;
default:
- printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
+ lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
return -1;
break;
}
@@ -394,7 +394,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r
state = 2;
break;
default:
- printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
+ lprintf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state);
return -1;
break;
}
@@ -438,16 +438,16 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r
default:
- printf("xmlparser: error: unknown parser state, state=%d\n", state);
+ lprintf("xmlparser: error: unknown parser state, state=%d\n", state);
return -1;
}
}
/* lex error */
- printf("xmlparser: error: lexer error\n");
+ lprintf("xmlparser: error: lexer error\n");
return -1;
} else {
/* max recursion */
- printf("xmlparser: error: max recursion\n");
+ lprintf("xmlparser: error: max recursion\n");
return -1;
}
}
@@ -463,7 +463,7 @@ int xml_parser_build_tree(xml_node_t **root_node) {
free_xml_node(tmp_node);
res = 0;
} else {
- printf("xmlparser: error: xml struct\n");
+ lprintf("xmlparser: error: xml struct\n");
xml_parser_free_tree(tmp_node);
res = -1;
}
@@ -573,4 +573,3 @@ static void xml_parser_dump_node (xml_node_t *node, int indent) {
void xml_parser_dump_tree (xml_node_t *node) {
xml_parser_dump_node (node, 0);
}
-