summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-11-30 18:04:01 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-11-30 18:08:30 +0100
commitfc931169d9cec785aea65b3146c80afdb994798a (patch)
tree20a2b528fb80085a9fd0a3ee455b09d9afbdfcdf /include
parent0c659242058605dd0ca5f4be979785aec8af27e8 (diff)
utils: remove type checks in min() and max()
So we can pass functions as parameters, needed by follow up patch. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/utils.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/include/utils.h b/include/utils.h
index 01560eae..e791523c 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -61,17 +61,11 @@
#define div_round_up(n, d) (((n) + (d) - 1) / (d))
#define round_up(n, b) (div_round_up(n, b) * b)
-#define min(x, y) ({ \
- typeof(x) _min1 = (x); \
- typeof(y) _min2 = (y); \
- (void) (&_min1 == &_min2); \
- _min1 < _min2 ? _min1 : _min2; })
-
-#define max(x, y) ({ \
- typeof(x) _max1 = (x); \
- typeof(y) _max2 = (y); \
- (void) (&_max1 == &_max2); \
- _max1 > _max2 ? _max1 : _max2; })
+#define min(_x, _y) ({ \
+ _x < _y ? _x : _y; })
+
+#define max(_x, _y) ({ \
+ _x > _y ? _x : _y; })
#define SNPRINTF_BUFFER_SIZE(ret, size, len, offset) \
if (ret < 0) \