[PATCH 03/16] qemuMonitorJSONAddDeviceProps: Simplify construction of the command

Peter Krempa posted 16 patches 4 years, 2 months ago
There is a newer version of this series
[PATCH 03/16] qemuMonitorJSONAddDeviceProps: Simplify construction of the command
Posted by Peter Krempa 4 years, 2 months ago
Use 'qemuMonitorJSONMakeCommandInternal' instead of
'qemuMonitorJSONMakeCommand' + 'virJSONValueObjectAppend'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_monitor_json.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index a3bdfaaf0d..2cfae2276d 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -4154,11 +4154,8 @@ qemuMonitorJSONAddDeviceProps(qemuMonitor *mon,
     g_autoptr(virJSONValue) cmd = NULL;
     g_autoptr(virJSONValue) reply = NULL;

-    if (!(cmd = qemuMonitorJSONMakeCommand("device_add", NULL)))
-        return -1;
-
-    if (virJSONValueObjectAppend(cmd, "arguments", props) < 0)
-        return -1;
+     if (!(cmd = qemuMonitorJSONMakeCommandInternal("device_add", props)))
+         return -1;

     if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
         return -1;
-- 
2.31.1

Re: [PATCH 03/16] qemuMonitorJSONAddDeviceProps: Simplify construction of the command
Posted by Ján Tomko 4 years, 2 months ago
On a Thursday in 2021, Peter Krempa wrote:
>Use 'qemuMonitorJSONMakeCommandInternal' instead of
>'qemuMonitorJSONMakeCommand' + 'virJSONValueObjectAppend'.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_monitor_json.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano