]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_caps: Prefer VIR_DOMAIN_CAPS_ENUM_IS_SET()
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 29 Sep 2025 12:54:17 +0000 (14:54 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 15 Oct 2025 08:04:11 +0000 (10:04 +0200)
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>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_capabilities.c

index 618291e5b612d2511d02e96a3889d88ffdf1f961..5b485d7bfbdce9bfa7ef4df2d378a0f5b6bec880 100644 (file)
@@ -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",