From: Mathieu Desnoyers Date: Tue, 13 Nov 2018 17:12:21 +0000 (-0500) Subject: Fix: max_t/min_t macros are missing cast on input X-Git-Tag: v2.11.0-rc2~156 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7ecdad94501ae813040e0c4a8333f9068e78b5d4;p=lttng-tools.git Fix: max_t/min_t macros are missing cast on input 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 --- diff --git a/src/common/macros.h b/src/common/macros.h index c42cddd50..f242da481 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 @@ -80,7 +80,7 @@ void *zmalloc(size_t len) #endif #ifndef min_t -#define min_t(type, a, b) ((type) min(a, b)) +#define min_t(type, a, b) min((type) a, (type) b) #endif #ifndef LTTNG_PACKED