summaryrefslogtreecommitdiff
path: root/src/xine-utils
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-11-30 00:53:50 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-11-30 00:53:50 +0000
commit873578a7965683e3e76420731c1d571908b54848 (patch)
treecd8153e478f39f9aac7c851672996a8e58ace71e /src/xine-utils
parentad5f52afbed82f29ba0816255edf1ff63533a2ff (diff)
downloadxine-lib-873578a7965683e3e76420731c1d571908b54848.tar.gz
xine-lib-873578a7965683e3e76420731c1d571908b54848.tar.bz2
Valid mrls are no more static (except few ones), like file suffix too.
First draft of compat.h (almost empty for now). CVS patchset: 1139 CVS date: 2001/11/30 00:53:50
Diffstat (limited to 'src/xine-utils')
-rw-r--r--src/xine-utils/Makefile.am2
-rw-r--r--src/xine-utils/compat.h42
-rw-r--r--src/xine-utils/utils.c9
-rw-r--r--src/xine-utils/xineutils.h95
4 files changed, 138 insertions, 10 deletions
diff --git a/src/xine-utils/Makefile.am b/src/xine-utils/Makefile.am
index 2f6da8855..22d6a99d3 100644
--- a/src/xine-utils/Makefile.am
+++ b/src/xine-utils/Makefile.am
@@ -12,7 +12,7 @@ libxineutils_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-release $(LT_RELEASE)
-include_HEADERS = xineutils.h attributes.h
+include_HEADERS = xineutils.h attributes.h compat.h
debug:
diff --git a/src/xine-utils/compat.h b/src/xine-utils/compat.h
new file mode 100644
index 000000000..1eac305b7
--- /dev/null
+++ b/src/xine-utils/compat.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: compat.h,v 1.1 2001/11/30 00:53:51 f1rmb Exp $
+ *
+ */
+
+#ifndef XINE_COMPAT_H
+#define XINE_COMPAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef __GNUC__
+#define __XINE_FUNCTION__ __func__
+#else
+#define __XINE_FUNCTION__ __FUNCTION__
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index 3fe910b15..11e45e5cd 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.3 2001/11/17 22:40:01 miguelfreitas Exp $
+ * $Id: utils.c,v 1.4 2001/11/30 00:53:51 f1rmb Exp $
*
*/
#define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */
@@ -36,10 +36,7 @@
#include <sys/types.h>
#include <pthread.h>
-#ifndef __GNUC__
-#define __FUNCTION__ __func__
-#endif
-
+#include "compat.h"
/*
*
@@ -49,7 +46,7 @@ void *xine_xmalloc(size_t size) {
if((ptr = malloc(size)) == NULL) {
fprintf(stderr, "%s: malloc() failed: %s.\n",
- __FUNCTION__, strerror(errno));
+ __XINE_FUNCTION__, strerror(errno));
return NULL;
}
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index 1655b3dd8..a4a689f4a 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.3 2001/11/18 03:53:25 guenter Exp $
+ * $Id: xineutils.h,v 1.4 2001/11/30 00:53:51 f1rmb Exp $
*
*/
#ifndef XINEUTILS_H
@@ -30,6 +30,7 @@ extern "C" {
#include <unistd.h>
#include <inttypes.h>
#include "attributes.h"
+#include "compat.h"
/* CPU Acceleration */
@@ -540,12 +541,27 @@ void xine_probe_fast_memcpy(config_values_t *config);
/* Debugging/Monitoring */
-#ifdef __GNUC__
+#ifdef __GNUC__
#define perr(FMT,ARGS...) {fprintf(stderr, FMT, ##ARGS);fflush(stderr);}
-#else /* C99 version: */
+#else /* C99 version: */
#define perr(...) {fprintf(stderr, __VA_ARGS__);fflush(stderr);}
#endif
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define xlerror(...) do { \
+ printf("XINE lib %s:%d:(%s) ", __FILE__, __LINE__, __XINE_FUNCTION__); \
+ printf(__VA_ARGS__); \
+ printf("\n"); \
+} while (0)
+#else
+#define xlerror(args...) do { \
+ printf("XINE lib %s:%d:(%s) ", __FILE__, __LINE__, __XINE_FUNCTION__); \
+ printf(##args); \
+ printf("\n"); \
+} while (0)
+#endif
+
+
#ifdef DEBUG
/*
* Debug stuff
@@ -608,6 +624,79 @@ char *xine_chomp (char *str);
void xine_usec_sleep(unsigned usec);
+ /*
+ * Some string functions
+ */
+
+
+void xine_strdupa(char *dest, char *src);
+#define xine_strdupa(d, s) { \
+ (d) = NULL; \
+ if((s) != NULL) { \
+ (d) = (char *) alloca(strlen((s)) + 1); \
+ strcpy((d), (s)); \
+ } \
+}
+
+/* Shamefully copied from glibc 2.2.3 */
+#ifdef HAVE_STRPBRK
+#define xine_strpbrk strpbrk
+#else
+static inline char *_x_strpbrk(const char *s, const char *accept) {
+
+ while(*s != '\0') {
+ const char *a = accept;
+ while(*a != '\0')
+ if(*a++ == *s)
+ return(char *) s;
+ ++s;
+ }
+
+ return NULL;
+}
+#define xine_strpbrk _x_strpbrk
+#endif
+
+#ifdef HAVE_STRSEP
+#define xine_strsep strsep
+#else
+static inline char *_x_strsep(char **stringp, const char *delim) {
+ char *begin, *end;
+
+ begin = *stringp;
+ if(begin == NULL)
+ return NULL;
+
+ if(delim[0] == '\0' || delim[1] == '\0') {
+ char ch = delim[0];
+
+ if(ch == '\0')
+ end = NULL;
+ else {
+ if(*begin == ch)
+ end = begin;
+ else if(*begin == '\0')
+ end = NULL;
+ else
+ end = strchr(begin + 1, ch);
+ }
+ }
+ else
+ end = xine_strpbrk(begin, delim);
+
+ if(end) {
+ *end++ = '\0';
+ *stringp = end;
+ }
+ else
+ *stringp = NULL;
+
+ return begin;
+}
+#define xine_strsep _x_strsep
+#endif
+
+
#ifdef __cplusplus
}
#endif