From 3eb7b04e0c3d422a18fc5ef8e61948f0fdc5e1e3 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 13 Nov 2018 12:12:21 -0500 Subject: [PATCH] Fix: max_t/min_t macros are missing cast on input MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The semantic expected from max_t and min_t is to perform the max/min comparison in the type provided as first parameter. Cast the input parameters to the proper type before comparing them, rather than after. There is no more need to cast the result of the expression now that both inputs are cast to the right type. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- src/common/macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/macros.h b/src/common/macros.h index 7eaf27cdf..13f51d9d1 100644 --- a/src/common/macros.h +++ b/src/common/macros.h @@ -72,7 +72,7 @@ void *zmalloc(size_t len) #endif #ifndef max_t -#define max_t(type, a, b) ((type) max(a, b)) +#define max_t(type, a, b) max((type) a, (type) b) #endif #ifndef min -- 2.34.1