]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
slirp: add Unix libc compatibility fallbacks
authorStefan Reinauer <stefan.reinauer@coreboot.org>
Sun, 31 May 2026 02:55:38 +0000 (19:55 -0700)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Sun, 31 May 2026 06:55:20 +0000 (23:55 -0700)
Provide container_of when the bundled SLIRP code needs it, and avoid
redeclaring the libc index function on Unix hosts that expose it.

slirp/slirp.h
slirp/slirp_config.h

index 5458c69b4c150fc48c3c4cf632d79d815b8fdf29..255f827a1391339d94f13224d65952c8015716a1 100644 (file)
@@ -81,6 +81,10 @@ typedef int ioctlsockopt_t;
 # include <stdint.h>
 #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;
index 0fed9bc6936a59e2011e04c0044190914c85d96a..794b768353618721d69a65a7a9bb0111a50ab2a3 100644 (file)
@@ -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