mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-18 22:05:55 -05:00
Re-enable os-wrappers-test.c on Darwin, fix errors
Signed-off-by: Torrekie Gen <me@torrekie.dev>
This commit is contained in:
parent
f430ba5bd5
commit
f9c13de55d
4 changed files with 43 additions and 9 deletions
|
|
@ -23,7 +23,26 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __APPLE__
|
||||
#define _GNU_SOURCE /* For memrchr */
|
||||
#else
|
||||
#include <string.h>
|
||||
/* No memrchr() on Darwin, borrow one from OpenBSD */
|
||||
static void *
|
||||
memrchr(const void *s, int c, size_t n)
|
||||
{
|
||||
const unsigned char *cp;
|
||||
|
||||
if (n != 0) {
|
||||
cp = (unsigned char *)s + n;
|
||||
do {
|
||||
if (*(--cp) == (unsigned char)c)
|
||||
return((void *)cp);
|
||||
} while (--n != 0);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue