summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-02-18 17:54:50 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-02-18 17:54:50 +0100
commita8f51c2e2c94387e7dcd95dcb12371b7253847f8 (patch)
tree0ddc3891823e2be8c293420ad72b144cf6223ba6 /util.h
parente6e971ba1b23bb67b43a909b486cbad5c6e96e06 (diff)
llmnrd: Add IPv6 support
Closes #5 Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'util.h')
-rw-r--r--util.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/util.h b/util.h
index 13a8637..d4933c4 100644
--- a/util.h
+++ b/util.h
@@ -30,7 +30,7 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
/*
- * min() macro with strict type-checking.
+ * min()/max() macros with strict type-checking.
* Taken from linux/kernel.h
*/
#undef min
@@ -40,6 +40,13 @@
(void) (&_min1 == &_min2); \
_min1 < _min2 ? _min1 : _min2; })
+#undef max
+#define max(x, y) ({ \
+ typeof(x) _max1 = (x); \
+ typeof(y) _max2 = (y); \
+ (void) (&_max1 == &_max2); \
+ _max1 > _max2 ? _max1 : _max2; })
+
static inline void __noreturn panic(const char *fmt, ...)
{
va_list vl;