mirror of https://github.com/mpv-player/mpv
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).
This commit is contained in:
parent
27a30e310e
commit
c0c9b26ff9
28
talloc.c
28
talloc.c
|
@ -30,6 +30,31 @@
|
||||||
inspired by http://swapped.cc/halloc/
|
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_
|
#ifdef _SAMBA_BUILD_
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#if (SAMBA_VERSION_MAJOR<4)
|
#if (SAMBA_VERSION_MAJOR<4)
|
||||||
|
@ -47,7 +72,8 @@
|
||||||
#endif /* _SAMBA_BUILD_ */
|
#endif /* _SAMBA_BUILD_ */
|
||||||
|
|
||||||
#ifndef _TALLOC_SAMBA3
|
#ifndef _TALLOC_SAMBA3
|
||||||
#include "replace.h"
|
// Workarounds for missing standard features, not used in MPlayer
|
||||||
|
// #include "replace.h"
|
||||||
#include "talloc.h"
|
#include "talloc.h"
|
||||||
#endif /* not _TALLOC_SAMBA3 */
|
#endif /* not _TALLOC_SAMBA3 */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue