From 343528d65ccee5df055b257b439232ca42097655 Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 22 Apr 2025 03:18:23 +0800 Subject: [PATCH] Resolve swab() conflict on macOS by adjusting includes On macOS, both and declar swab(), which may result in a conflicting types error due to differences in declaration qualifiers. According to POSIX, swab() is officially declared in . macOS also declares it in for compatibility, but without proper include guards. This PR resolves the issue by: - Reordering includes in util.h to ensure appears before - Removing a redundant include in vmstate.c Tested on macOS 12.1 --- src/util.h | 3 +-- src/vmstate.c | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/util.h b/src/util.h index eea23e8..9106161 100644 --- a/src/util.h +++ b/src/util.h @@ -24,8 +24,6 @@ #ifndef UTIL_H_ #define UTIL_H_ -#include "tinyglib.h" - #include #include #include @@ -47,6 +45,7 @@ #endif #include "libslirp.h" +#include "tinyglib.h" #ifdef __GNUC__ #define SLIRP_PACKED_BEGIN diff --git a/src/vmstate.c b/src/vmstate.c index 4f2aed0..02eb7ee 100644 --- a/src/vmstate.c +++ b/src/vmstate.c @@ -39,10 +39,6 @@ */ #include #include -#include -#include "tinyglib.h" - -#include "stream.h" #include "vmstate.h" static int get_nullptr(SlirpIStream *f, void *pv, size_t size,