shithub: libsamplerate

Download patch

ref: 8350b763ca3b6b3e6676d9f411480b8a8575ca04
parent: 0fcc45fde036246ed3215f767cc038ba75838168
author: Erik de Castro Lopo <erikd@mega-nerd.com>
date: Sat Jan 11 12:08:55 EST 2020

Add #ifndef guard around MIN/MAX macros

Closes: https://github.com/erikd/libsamplerate/issues/97

--- a/src/common.h
+++ b/src/common.h
@@ -18,8 +18,13 @@
 
 #define	SRC_MIN_RATIO_DIFF		(1e-20)
 
+#ifndef MAX
 #define	MAX(a,b)	(((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef MIN
 #define	MIN(a,b)	(((a) < (b)) ? (a) : (b))
+#endif
 
 #define	ARRAY_LEN(x)			((int) (sizeof (x) / sizeof ((x) [0])))
 #define OFFSETOF(type,member)	((int) (&((type*) 0)->member))
--- a/tests/util.h
+++ b/tests/util.h
@@ -9,8 +9,14 @@
 #include "src_config.h"
 
 #define	ABS(a)			(((a) < 0) ? - (a) : (a))
-#define MIN(a,b)		(((a) < (b)) ? (a) : (b))
-#define	MAX(a,b)		(((a) >= (b)) ? (a) : (b))
+
+#ifndef MAX
+#define	MAX(a,b)		(((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef MIN
+#define	MIN(a,b)		(((a) < (b)) ? (a) : (b))
+#endif
 
 #define	ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))