From 328cb94928e9584060f2c3903901c6613985a126 Mon Sep 17 00:00:00 2001 From: softmattertheory Date: Thu, 7 Apr 2022 08:21:43 -0400 Subject: [PATCH] Change morpho_isfalse Into a regular function. This avoids a possible bug/C violation. --- morpho5/datastructures/value.c | 5 +++++ morpho5/datastructures/value.h | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/morpho5/datastructures/value.c b/morpho5/datastructures/value.c index 260bace6..b12d75c3 100644 --- a/morpho5/datastructures/value.c +++ b/morpho5/datastructures/value.c @@ -7,6 +7,11 @@ #include "value.h" #include "common.h" +/** Define notion of falsity/truthyness */ +bool morpho_isfalse(value a) { + return (MORPHO_ISNIL(a) || (MORPHO_ISBOOL(a) && (MORPHO_GETBOOLVALUE(a)==false))); +} + DEFINE_VARRAY(value, value); /** @brief Finds a value in an varray using a loose equality test (MORPHO_ISEQUAL) diff --git a/morpho5/datastructures/value.h b/morpho5/datastructures/value.h index b4546038..4d617657 100644 --- a/morpho5/datastructures/value.h +++ b/morpho5/datastructures/value.h @@ -177,9 +177,7 @@ static inline bool morpho_isnumber(value a) { #define MORPHO_FLOATTOINTEGER(x) (MORPHO_INTEGER((int) round(MORPHO_GETFLOATVALUE((x))))) /** Define notion of falsity/truthyness */ -static inline bool morpho_isfalse(value a) { - return (MORPHO_ISNIL(a) || (MORPHO_ISBOOL(a) && (MORPHO_GETBOOLVALUE(a)==false))); -} +bool morpho_isfalse(value a); #define MORPHO_ISFALSE(x) (morpho_isfalse(x)) #define MORPHO_ISTRUE(x) (!morpho_isfalse(x))