From: Stefan Reinauer Date: Sun, 31 May 2026 02:55:38 +0000 (-0700) Subject: slirp: add Unix libc compatibility fallbacks X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=5b372917ced44b7bcbb635b48e76e5a947d554bc;p=francis%2Fwinuae.git slirp: add Unix libc compatibility fallbacks Provide container_of when the bundled SLIRP code needs it, and avoid redeclaring the libc index function on Unix hosts that expose it. --- diff --git a/slirp/slirp.h b/slirp/slirp.h index 5458c69b..255f827a 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -81,6 +81,10 @@ typedef int ioctlsockopt_t; # include #endif +#ifndef container_of +#define container_of(address, type, field) ((type *)((char *)(address) - (uintptr_t)(&((type *)0)->field))) +#endif + #ifdef NEED_TYPEDEFS typedef char int8_t; typedef unsigned char u_int8_t; diff --git a/slirp/slirp_config.h b/slirp/slirp_config.h index 0fed9bc6..794b7683 100644 --- a/slirp/slirp_config.h +++ b/slirp/slirp_config.h @@ -92,6 +92,9 @@ /* Define if you have index() */ #undef HAVE_INDEX +#ifndef _WIN32 +#define HAVE_INDEX +#endif /* Define if you have bcmp() */ #undef HAVE_BCMP