[PATCH 05/23] virsh: virshVcpuinfoPrintAffinity: Use if-else instead of ternary operator

Peter Krempa pkrempa at redhat.com
Wed Mar 2 13:55:04 UTC 2022


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tools/virsh-domain.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 732690ec44..73f05ce7f9 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6721,8 +6721,12 @@ virshVcpuinfoPrintAffinity(vshControl *ctl,
             return -1;
         vshPrint(ctl, _("%s (out of %d)"), str, maxcpu);
     } else {
-        for (i = 0; i < maxcpu; i++)
-            vshPrint(ctl, "%c", VIR_CPU_USED(cpumap, i) ? 'y' : '-');
+        for (i = 0; i < maxcpu; i++) {
+            if (VIR_CPU_USED(cpumap, i))
+                vshPrint(ctl, "y");
+            else
+                vshPrint(ctl, "-");
+        }
     }
     vshPrint(ctl, "\n");

-- 
2.35.1




More information about the libvir-list mailing list