mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-07 01:13:49 +00:00
virsh: Don't open-code virJSONStringReformat in cmdQemuMonitorCommand
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
d2335ac577
commit
73aaa8f8c8
@ -9512,7 +9512,6 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
const vshCmdOpt *opt = NULL;
|
const vshCmdOpt *opt = NULL;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
VIR_AUTOPTR(virJSONValue) pretty = NULL;
|
|
||||||
|
|
||||||
VSH_EXCLUSIVE_OPTIONS("hmp", "pretty");
|
VSH_EXCLUSIVE_OPTIONS("hmp", "pretty");
|
||||||
|
|
||||||
@ -9538,8 +9537,7 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
if (vshCommandOptBool(cmd, "pretty")) {
|
if (vshCommandOptBool(cmd, "pretty")) {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
pretty = virJSONValueFromString(result);
|
if ((tmp = virJSONStringReformat(result, true))) {
|
||||||
if (pretty && (tmp = virJSONValueToString(pretty, true))) {
|
|
||||||
VIR_FREE(result);
|
VIR_FREE(result);
|
||||||
result = tmp;
|
result = tmp;
|
||||||
virTrimSpaces(result, NULL);
|
virTrimSpaces(result, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user