This is a convenient macro for querying whether particular domain
caps enum value is set or not.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/domain_capabilities.c | 2 +-
src/conf/domain_capabilities.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 8a690a57a3..8130311590 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -287,7 +287,7 @@ virDomainCapsEnumFormat(virBufferPtr buf,
for (i = 0; i < sizeof(capsEnum->values) * CHAR_BIT; i++) {
const char *val;
- if (!(capsEnum->values & (1 << i)))
+ if (!VIR_DOMAIN_CAPS_ENUM_IS_SET(*capsEnum, i))
continue;
if ((val = (valToStr)(i)))
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 4ae6f0fbb1..f177af1744 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -214,6 +214,8 @@ virDomainCapsCPUModelPtr
virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels,
const char *name);
+#define VIR_DOMAIN_CAPS_ENUM_IS_SET(capsEnum, value) \
+ ((capsEnum).values & (1 << value))
#define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \
do { \
--
2.26.2