]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix compilation on macOS
authorSean Purcell <me@seanp.xyz>
Thu, 13 Apr 2017 19:33:45 +0000 (12:33 -0700)
committerSean Purcell <me@seanp.xyz>
Thu, 13 Apr 2017 19:33:45 +0000 (12:33 -0700)
programs/bench.c
programs/dibio.c
programs/fileio.c
programs/util.h

index d25ff8f04afcf18be2edf276a77e2d4ba0a6e7fa..8d8ed4ffaa55ff89fc35c97beaecbdbceccea244 100644 (file)
@@ -146,8 +146,13 @@ typedef struct {
 } blockParam_t;
 
 
-#define MIN(a,b) ((a)<(b) ? (a) : (b))
-#define MAX(a,b) ((a)>(b) ? (a) : (b))
+
+#ifndef MIN
+#   define MIN(a,b)    ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
+#   define MAX(a,b)    ((a) > (b) ? (a) : (b))
+#endif
 
 static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
                         const char* displayName, int cLevel,
index b7ed280eaacfbdeca691fba80083e7eddfadc619..5e685a325f83a01948a52de6f4b918cf4cf50eb1 100644 (file)
@@ -89,7 +89,9 @@ unsigned DiB_isError(size_t errorCode) { return ERR_isError(errorCode); }
 
 const char* DiB_getErrorName(size_t errorCode) { return ERR_getErrorName(errorCode); }
 
-#define MIN(a,b)   ( (a) < (b) ? (a) : (b) )
+#ifndef MIN
+#   define MIN(a,b)    ((a) < (b) ? (a) : (b))
+#endif
 
 
 /* ********************************************************
index f1f5a55777d46538b96a26d044b7f0c7553b2b90..1dc222b656c9afea940347cf98b8e6b7da5bbaf6 100644 (file)
@@ -96,7 +96,9 @@ void FIO_setNotificationLevel(unsigned level) { g_displayLevel=level; }
 static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100;
 static clock_t g_time = 0;
 
-#define MIN(a,b)    ((a) < (b) ? (a) : (b))
+#ifndef MIN
+#   define MIN(a,b)    ((a) < (b) ? (a) : (b))
+#endif
 
 /* ************************************************************
 * Avoid fseek()'s 2GiB barrier with MSVC, MacOS, *BSD, MinGW
index 0b90cda19c4541e79dd36421f15455fe11194513..104f8dad2741a8835bc2ef634263fb2b7d584dc8 100644 (file)
@@ -569,7 +569,8 @@ UTIL_STATIC int UTIL_countPhysicalCores(void)
     static S32 numPhysicalCores; /* apple specifies int32_t */
     if (numPhysicalCores != 0) return numPhysicalCores;
 
-    {   int const ret = sysctlbyname("hw.physicalcpu", &numPhysicalCores, sizeof(int), NULL, 0);
+    {   size_t size = sizeof(S32);
+        int const ret = sysctlbyname("hw.physicalcpu", &numPhysicalCores, &size, NULL, 0);
         if (ret != 0) {
             if (errno == ENOENT) {
                 /* entry not present, fall back on 1 */