From a5ee74ed91bd81b80c564508ccaaf0baec40dde8 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 8 Mar 2020 11:36:45 +1000 Subject: [PATCH] Rearrange some includes. Some headers are only required for the device IO API. This commit moves these headers to the device IO section that they're excluded when MA_NO_DEVICE_IO is set. Public issue https://github.com/dr-soft/miniaudio/issues/138 --- miniaudio.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/miniaudio.h b/miniaudio.h index c0075398..e8c55fe5 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -5499,25 +5499,11 @@ IMPLEMENTATION #ifdef MA_WIN32 #include -#include -#include -#include #else #include /* For malloc(), free(), wcstombs(). */ #include /* For memset() */ #endif -#if defined(MA_APPLE) && (__MAC_OS_X_VERSION_MIN_REQUIRED < 101200) -#include /* For mach_absolute_time() */ -#endif - -#ifdef MA_POSIX -#include -#include -#include -#include -#endif - #ifdef MA_EMSCRIPTEN #include #endif @@ -7446,6 +7432,23 @@ DEVICE I/O ************************************************************************************************************************************************************* ************************************************************************************************************************************************************/ #ifndef MA_NO_DEVICE_IO +#ifdef MA_WIN32 + #include + #include + #include +#endif + +#if defined(MA_APPLE) && (__MAC_OS_X_VERSION_MIN_REQUIRED < 101200) + #include /* For mach_absolute_time() */ +#endif + +#ifdef MA_POSIX + #include + #include + #include + #include +#endif + /* Unfortunately using runtime linking for pthreads causes problems. This has occurred for me when testing on FreeBSD. When using runtime linking, deadlocks can occur (for me it happens when loading data from fread()). It turns out that doing