[PATCH 06/20] qemu_caps: Prefer VIR_DOMAIN_CAPS_ENUM_IS_SET()

Michal Privoznik via Devel posted 20 patches 3 weeks ago
There is a newer version of this series
[PATCH 06/20] qemu_caps: Prefer VIR_DOMAIN_CAPS_ENUM_IS_SET()
Posted by Michal Privoznik via Devel 3 weeks ago
From: Michal Privoznik <mprivozn@redhat.com>

While virDomainCapsEnum is in fact a bitmap, we also have a macro
to manipulate/query individual bits. Prefer it to make the code
more readable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_capabilities.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 618291e5b6..5b485d7bfb 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5065,7 +5065,7 @@ virQEMUCapsFormatHypervCapabilities(virQEMUCaps *qemuCaps,
         size_t i;
 
         for (i = 0; i < sizeof(hvcaps->features.values) * CHAR_BIT; i++) {
-            if (!(hvcaps->features.values & (1U << i)))
+            if (!VIR_DOMAIN_CAPS_ENUM_IS_SET(hvcaps->features, i))
                 continue;
 
             virBufferAsprintf(&childBuf, "<cap name='%s'/>\n",
-- 
2.49.1