mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
scanner: Add configure check for strndup
Some platforms may not have strndup() (e.g. MinGW), so provide a equivalent implementation if it's not found. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
This commit is contained in:
parent
8e0513410d
commit
4a1f348c20
2 changed files with 12 additions and 1 deletions
|
|
@ -63,7 +63,7 @@ fi
|
||||||
AC_SUBST(GCC_CFLAGS)
|
AC_SUBST(GCC_CFLAGS)
|
||||||
|
|
||||||
AC_CHECK_HEADERS([sys/prctl.h])
|
AC_CHECK_HEADERS([sys/prctl.h])
|
||||||
AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate prctl memfd_create])
|
AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate prctl memfd_create strndup])
|
||||||
|
|
||||||
# *BSD don't have libdl, but they have its functions in libc
|
# *BSD don't have libdl, but they have its functions in libc
|
||||||
WESTON_SEARCH_LIBS([DL], [dl], [dlsym])
|
WESTON_SEARCH_LIBS([DL], [dl], [dlsym])
|
||||||
|
|
|
||||||
|
|
@ -975,6 +975,17 @@ verify_arguments(struct parse_context *ctx,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_STRNDUP
|
||||||
|
char *
|
||||||
|
strndup(const char *s, size_t size)
|
||||||
|
{
|
||||||
|
char *r = malloc(size + 1);
|
||||||
|
strncpy(r, s, size);
|
||||||
|
r[size] = '\0';
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
end_element(void *data, const XML_Char *name)
|
end_element(void *data, const XML_Char *name)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue