From fc931169d9cec785aea65b3146c80afdb994798a Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 30 Nov 2018 18:04:01 +0100 Subject: 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 --- include/utils.h | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'include/utils.h') 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) \ -- cgit v1.2.3