Add alternative macro M_TEST_METHOD_ALTER_P

This commit is contained in:
Patrick Pelissier committed 2021-11-03 20:54:03 +01:00
1 parent bc7552f4a8
commit b2d3d86e0c
2 files changed
+9 -1

No files matched your search

+6 -1
View File
@@ -3336,11 +3336,16 @@ m_core_parse2_enum (const char str[], const char **endptr)
/* Test if a method is present in an oplist.
Return 0 (method is absent or disabled) or 1 (method is present and not disabled).
NOTE: Does not work if method is OPLIST, KEY_OPLIST or VALUE_OPLIST.
NOTE: M_TEST_METHOD_P does not work if method is something within parenthesis (like OPLIST*)
In this case, you shall use the M_TEST_METHOD_ALTER_P macro (safer but slower).
*/
#define M_TEST_METHOD_P(method, oplist) \
M_BOOL(M_GET_METHOD (method, 0, M_OPFLAT oplist))
#define M_TEST_METHOD_ALTER_P(method, oplist) \
M_INV(M_EMPTY_P(M_GET_METHOD (method, , M_OPFLAT oplist)))
/* Test if a method is disabled in an oplist.
To disable an oplist, just put '0' in the method like this:
Example: (INIT(0), CLEAR(clear))