summaryrefslogtreecommitdiffstats
path: root/libhb/compat.h
diff options
context:
space:
mode:
authorRodeo <[email protected]>2015-04-10 14:56:27 +0000
committerRodeo <[email protected]>2015-04-10 14:56:27 +0000
commit864ce5a4227d81f688f32e808245b2600f431ac3 (patch)
tree80fe0b03201bac220a3d2c291129381752b888db /libhb/compat.h
parentf360714523e5f1f78ced2ae8691f3087b80eef65 (diff)
Move strtok_r fallback to dedicated "compat" files.
Also, check whether the toolchain already provides strtok_r instead of building it unconditionally. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7076 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/compat.h')
-rw-r--r--libhb/compat.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/libhb/compat.h b/libhb/compat.h
new file mode 100644
index 000000000..40283c907
--- /dev/null
+++ b/libhb/compat.h
@@ -0,0 +1,28 @@
+/* compat.h
+
+ Copyright (c) 2003-2015 HandBrake Team
+ This file is part of the HandBrake source code
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License v2.
+ For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
+ */
+
+#ifndef HB_COMPAT_H
+#define HB_COMPAT_H
+
+#ifdef HB_NEED_STRTOK_R
+/*
+ * Some MinGW-w64 distributions #define strtok_r in pthread.h,
+ * however their so-called "implementation" isn't thread-safe.
+ */
+#ifdef USE_PTHREAD
+#include <pthread.h>
+#ifdef strtok_r
+#undef strtok_r
+#endif // strtok_r
+#endif // USE_PTHREAD
+
+char *strtok_r(char *s, const char *delim, char **save_ptr);
+#endif // HB_NEED_STRTOK_R
+
+#endif // HB_COMPAT_H