summaryrefslogtreecommitdiffstats
path: root/include/haproxy/compat.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/haproxy/compat.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/haproxy/compat.h b/include/haproxy/compat.h
index 0fe5a0b..3829060 100644
--- a/include/haproxy/compat.h
+++ b/include/haproxy/compat.h
@@ -94,11 +94,19 @@ typedef struct { } empty_t;
#endif
#ifndef MIN
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define MIN(a, b) ({ \
+ typeof(a) _a = (a); \
+ typeof(a) _b = (b); \
+ ((_a < _b) ? _a : _b); \
+})
#endif
#ifndef MAX
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#define MAX(a, b) ({ \
+ typeof(a) _a = (a); \
+ typeof(a) _b = (b); \
+ ((_a > _b) ? _a : _b); \
+})
#endif
/* this is for libc5 for example */