From 44c313245768702786b5ef0c0e88c0bd856c2a5e Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Thu, 28 Feb 2019 10:08:23 +0100 Subject: [PATCH] eina: safe guard against macro expension error in EINA_*_EQ Make sure we are use doubel also also in things like EINA_DBL_EQ(a-b, x+y). Thanks to Vicent for reporting and Xavi for giving me context. Reviewed-by: Vincent Torri Differential Revision: https://phab.enlightenment.org/D8049 --- src/lib/eina/eina_util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/eina/eina_util.h b/src/lib/eina/eina_util.h index 6afd424..08b1523 100644 --- a/src/lib/eina/eina_util.h +++ b/src/lib/eina/eina_util.h @@ -78,7 +78,7 @@ static inline Eina_Bool eina_flt_exact(float a, float b); * * @return @c true if two floats match */ -#define EINA_FLT_EQ(a, b) (!!(fabsf((float)a - (float)b) <= FLT_EPSILON)) +#define EINA_FLT_EQ(a, b) (!!(fabsf((float)(a) - (float)(b)) <= FLT_EPSILON)) /** * @brief Determines if a float is not zero @@ -97,7 +97,7 @@ static inline Eina_Bool eina_flt_exact(float a, float b); * * @return @c true if two double match */ -#define EINA_DBL_EQ(a, b) (!!(fabs((double)a - (double)b) <= DBL_EPSILON)) +#define EINA_DBL_EQ(a, b) (!!(fabs((double)(a) - (double)(b)) <= DBL_EPSILON)) /** * @brief Determines if a double is not zero -- 2.7.4