瀏覽代碼

Don't use getpagesize() on Windows

Fixes https://github.com/libsdl-org/SDL/issues/14328
Sam Lantinga 4 月之前
父節點
當前提交
ea8e66ccd1
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/cpuinfo/SDL_cpuinfo.c

+ 6 - 2
src/cpuinfo/SDL_cpuinfo.c

@@ -29,7 +29,11 @@
 
 // CPU feature detection for SDL
 
-#if defined(HAVE_SYSCONF) || defined(HAVE_GETPAGESIZE)
+#if defined(HAVE_GETPAGESIZE) && !defined(SDL_PLATFORM_WINDOWS)
+#define USE_GETPAGESIZE
+#endif
+
+#if defined(HAVE_SYSCONF) || defined(USE_GETPAGESIZE)
 #include <unistd.h>
 #endif
 #ifdef HAVE_SYSCTLBYNAME
@@ -1252,7 +1256,7 @@ int SDL_GetSystemPageSize(void)
             }
         }
 #endif
-#ifdef HAVE_GETPAGESIZE
+#ifdef USE_GETPAGESIZE
         if (SDL_SystemPageSize <= 0) {
             SDL_SystemPageSize = getpagesize();
         }