diff --git a/meson.build b/meson.build index 15564db6..e264aecd 100644 --- a/meson.build +++ b/meson.build @@ -49,6 +49,7 @@ endforeach have_funcs = [ 'accept4', 'getpeereid', + 'memrchr', 'mkostemp', 'posix_fallocate', 'ppoll', diff --git a/tests/queue-test.c b/tests/queue-test.c index 2b2d9ad4..4867b5a3 100644 --- a/tests/queue-test.c +++ b/tests/queue-test.c @@ -24,6 +24,7 @@ */ #define _GNU_SOURCE /* For memrchr */ +#include "../config.h" #include #include #include @@ -36,6 +37,19 @@ #include #include +#ifndef HAVE_MEMRCHR +static void * +memrchr(const void *s, int c, size_t n) +{ + const unsigned char *p = (const unsigned char *)s + n; + while (n--) { + if (*--p == (unsigned char)c) + return (void *)p; + } + return NULL; +} +#endif + #include "wayland-client.h" #include "wayland-server.h" #include "test-runner.h"