]> wimlib.net Git - wimlib/commitdiff
Fix 'MAX' redefined warning on macOS
authorEric Biggers <ebiggers3@gmail.com>
Sat, 18 Mar 2023 07:17:54 +0000 (00:17 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 18 Mar 2023 07:17:54 +0000 (00:17 -0700)
include/wimlib/compiler.h

index 91445b2a6ada21275e9648ff5c1cff79f7c248d0..742f3bfce1a0302fea405e77b11180a20890ffbe 100644 (file)
 #define typeof     __typeof__
 
 /* Get the minimum of two variables, without multiple evaluation.  */
-#ifndef min
-#  define min(a, b)  ({ typeof(a) _a = (a); typeof(b) _b = (b); \
-                       (_a < _b) ? _a : _b; })
-#endif
+#undef min
+#define min(a, b)  ({ typeof(a) _a = (a); typeof(b) _b = (b); \
+                   (_a < _b) ? _a : _b; })
+#undef MIN
 #define MIN(a, b)      min((a), (b))
 
 /* Get the maximum of two variables, without multiple evaluation.  */
-#ifndef max
-#  define max(a, b)  ({ typeof(a) _a = (a); typeof(b) _b = (b); \
-                       (_a > _b) ? _a : _b; })
-#endif
+#undef max
+#define max(a, b)  ({ typeof(a) _a = (a); typeof(b) _b = (b); \
+                   (_a > _b) ? _a : _b; })
+#undef MAX
 #define MAX(a, b)      max((a), (b))
 
 /* Swap the values of two variables, without multiple evaluation.  */