]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuMonitorJSONHandleShutdown: Use virTristateBoolFromBool
authorPeter Krempa <pkrempa@redhat.com>
Tue, 30 Nov 2021 15:07:53 +0000 (16:07 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 7 Dec 2021 08:00:39 +0000 (09:00 +0100)
Instead of a ternary operator we can use the existing helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor_json.c

index a72d7c20993d725c0c92f9d644885cf653f8dcd8..b45aae9d963e1348f810a7b2e7a4fb68a72a140c 100644 (file)
@@ -574,7 +574,7 @@ static void qemuMonitorJSONHandleShutdown(qemuMonitor *mon, virJSONValue *data)
     virTristateBool guest_initiated = VIR_TRISTATE_BOOL_ABSENT;
 
     if (data && virJSONValueObjectGetBoolean(data, "guest", &guest) == 0)
-        guest_initiated = guest ? VIR_TRISTATE_BOOL_YES : VIR_TRISTATE_BOOL_NO;
+        guest_initiated = virTristateBoolFromBool(guest);
 
     qemuMonitorEmitShutdown(mon, guest_initiated);
 }