summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-20 05:13:25 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-23 13:41:06 +0300
commitc0c9b26ff96df8dfe89c4c52c70e2c6b2e30100f (patch)
tree18045d6fab093cb446336148011083c0b84b3500
parent27a30e310e1d2b2bbc9b381fe08b6ade403784e2 (diff)
downloadmpv-c0c9b26ff96df8dfe89c4c52c70e2c6b2e30100f.tar.bz2
mpv-c0c9b26ff96df8dfe89c4c52c70e2c6b2e30100f.tar.xz
Hardcode feature checks in talloc.c
Original talloc build system used autoconf to check for features, most of which were standard C headers. Assume those always exist. Always use a workaround for the one non-standard feature (strnlen).
-rw-r--r--talloc.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/talloc.c b/talloc.c
index 12b85f5a65..d63e4c61c9 100644
--- a/talloc.c
+++ b/talloc.c
@@ -30,6 +30,31 @@
inspired by http://swapped.cc/halloc/
*/
+// Hardcode these for MPlayer assuming a working system.
+// Original used autoconf detection with workarounds for broken systems.
+#define HAVE_VA_COPY
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#define MIN(a,b) ((a)<(b)?(a):(b))
+#define strnlen rep_strnlen
+static size_t rep_strnlen(const char *s, size_t max)
+{
+ size_t len;
+
+ for (len = 0; len < max; len++) {
+ if (s[len] == '\0') {
+ break;
+ }
+ }
+ return len;
+}
+
+
+
#ifdef _SAMBA_BUILD_
#include "version.h"
#if (SAMBA_VERSION_MAJOR<4)
@@ -47,7 +72,8 @@
#endif /* _SAMBA_BUILD_ */
#ifndef _TALLOC_SAMBA3
-#include "replace.h"
+// Workarounds for missing standard features, not used in MPlayer
+// #include "replace.h"
#include "talloc.h"
#endif /* not _TALLOC_SAMBA3 */