]> git.sesse.net Git - vlc/blobdiff - include/vlc_fixups.h
compat: implement tdestroy (GNU extension not available on OpenBSD).
[vlc] / include / vlc_fixups.h
index 5636832a6b027999450f4c4d240898c531218775..3512029d9c0051630c0fcbff16c202a4cfa3e185 100644 (file)
@@ -38,13 +38,19 @@ typedef struct
 } lldiv_t;
 #endif
 
+#if !defined(HAVE_GETENV) || \
+    !defined(HAVE_USELOCALE)
+# include <stddef.h> /* NULL */
+#endif
+
 #ifndef HAVE_REWIND
 # include <stdio.h> /* FILE */
 #endif
 
 #if !defined (HAVE_STRLCPY) || \
     !defined (HAVE_STRNDUP) || \
-    !defined (HAVE_STRNLEN)
+    !defined (HAVE_STRNLEN) || \
+    !defined (HAVE_GETCWD)
 # include <stddef.h> /* size_t */
 #endif
 
@@ -52,6 +58,10 @@ typedef struct
 # include <stdarg.h> /* va_list */
 #endif
 
+#ifndef HAVE_GETPID
+# include <sys/types.h> /* pid_t */
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -128,6 +138,18 @@ struct tm *localtime_r (const time_t *, struct tm *);
 void rewind (FILE *);
 #endif
 
+#ifndef HAVE_GETCWD
+char *getcwd (char *buf, size_t size);
+#endif
+
+#ifndef HAVE_GETPID
+pid_t getpid (void);
+#endif
+
+#ifndef HAVE_STRTOK_R
+char *strtok_r(char *, const char *, char **);
+#endif
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
@@ -148,10 +170,22 @@ static inline char *getenv (const char *name)
 #endif
 
 #ifndef HAVE_USELOCALE
+#define LC_NUMERIC_MASK 0
 typedef void *locale_t;
-# define newlocale( a, b, c ) ((locale_t)0)
-# define uselocale( a ) ((locale_t)0)
-# define freelocale( a ) (void)0
+static inline locale_t uselocale(locale_t loc)
+{
+    (void)loc;
+    return NULL;
+}
+static inline void freelocale(locale_t loc)
+{
+    (void)loc;
+}
+static inline locale_t newlocale(int mask, const char * locale, locale_t base)
+{
+    (void)mask; (void)locale; (void)base;
+    return NULL;
+}
 #endif
 
 #ifdef WIN32
@@ -170,4 +204,9 @@ typedef void *locale_t;
 void swab (const void *, void *, ssize_t);
 #endif
 
+#ifndef HAVE_TDESTROY
+typedef void (*__free_fn_t) (void *__nodep);
+void tdestroy (void *vroot, __free_fn_t freefct);
+#endif
+
 #endif /* !LIBVLC_FIXUPS_H */