mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-09-10 12:02:53 +02:00
Prevent SANDBOX_VALUE_TO_BOOL()
macro from double-evaluating its argument
This commit is contained in:
parent
6f4ac73a43
commit
a1c9ad01be
1 changed files with 5 additions and 1 deletions
|
@ -65,7 +65,11 @@
|
|||
sb()._end_yield(); \
|
||||
} while (0)
|
||||
|
||||
#define SANDBOX_VALUE_TO_BOOL(value) ((value) != SANDBOX_FALSE && (value) != SANDBOX_NIL)
|
||||
#ifdef __GNUC__
|
||||
# define SANDBOX_VALUE_TO_BOOL(value) ({ auto _value = (value); _value != SANDBOX_FALSE && _value != SANDBOX_NIL; })
|
||||
#else
|
||||
# define SANDBOX_VALUE_TO_BOOL(value) ([=]() { auto _value = (value); return _value != SANDBOX_FALSE && _value != SANDBOX_NIL; }())
|
||||
#endif // __GNUC__
|
||||
|
||||
#define SANDBOX_BOOL_TO_VALUE(boolean) ((boolean) ? SANDBOX_TRUE : SANDBOX_FALSE)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue