-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Description
Following the conversion here: #7783
We want to suggest an API to discover if given flags are supported for a given feature (Context Flags, Key space notification flags, ..)
API suggestion
Introduce an API int RM_IsFlagsSupported(int feature, int flags) that for a set of flags and feature, will return boolean indicating if those flags are supported. The features are:
CONTEXT_FLAGS
KEY_SPACE_NOTIFICATIONS_FLAGS
EVENTS_FLAG
The flags can be either a single flag or a multiple flags combine with OR operation. The function will return true only if all the given flags are supported.
And we can also create a specific macro for each feature to wrap it:
#define IS_CTX_FLAGS_SUPPORTED(flags): RM_IsFlagsSupported(CONTEXT_FLAGS, flags)
#define IS_KEYSPAE_FLAGS_SUPPORTED(flags): RM_IsFlagsSupported(KEY_SPACE_NOTIFICATIONS_FLAGS, flags)
#define IS_EVENT_FLAGS_SUPPORTED(flags): RM_IsFlagsSupported(EVENTS_FLAG, flags)
Regardless, we can add a macro (as suggested by @yossigo) that will tell whether or no a given API function is supported (the macro will simply check if the function pointer is NULL): RMAPI_FUNC_SUPPORTED(functionName)
Let me know what you think.