Merge branch 'Torrekie-main-patch-86758' into 'main'

Add Darwin support

Closes #310

See merge request wayland/wayland!380
This commit is contained in:
Torrekie Gen 2026-01-26 20:22:19 +00:00
commit 5bbf292d4c
13 changed files with 215 additions and 18 deletions

View file

@ -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>