]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Don't open-code virJSONStringReformat in cmdQemuMonitorCommand
authorPeter Krempa <pkrempa@redhat.com>
Mon, 9 Sep 2019 08:55:20 +0000 (10:55 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 19 Sep 2019 12:31:15 +0000 (14:31 +0200)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/virsh-domain.c

index 8c24935938485fe0a8760629d1945d9368644da2..fbfdc09c0d54daae294a13075950352f44551414 100644 (file)
@@ -9512,7 +9512,6 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
     unsigned int flags = 0;
     const vshCmdOpt *opt = NULL;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
-    VIR_AUTOPTR(virJSONValue) pretty = NULL;
 
     VSH_EXCLUSIVE_OPTIONS("hmp", "pretty");
 
@@ -9538,8 +9537,7 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
 
     if (vshCommandOptBool(cmd, "pretty")) {
         char *tmp;
-        pretty = virJSONValueFromString(result);
-        if (pretty && (tmp = virJSONValueToString(pretty, true))) {
+        if ((tmp = virJSONStringReformat(result, true))) {
             VIR_FREE(result);
             result = tmp;
             virTrimSpaces(result, NULL);