[PATCH nft 1/3] utils: remove type checks in min() and max()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So we can pass functions as parameters, needed by follow up patch.

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 include/utils.h | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/include/utils.h b/include/utils.h
index 01560eae8d7f..e791523c0471 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)					\
-- 
2.11.0





[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux