[libvirt] [PATCH 3/3] qemu: simplify json parsing

Eric Blake eblake at redhat.com
Mon Jun 22 13:52:56 UTC 2015


On 06/20/2015 01:42 PM, Eric Blake wrote:
> Rather than grabbing an arbitrary JSON value and then checking
> if it has the right type, we might as well request the correct
> type to begin with.

> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  src/qemu/qemu_monitor_json.c | 164 ++++++++++++++++---------------------------
>  1 file changed, 61 insertions(+), 103 deletions(-)
> 

> @@ -271,7 +269,7 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
> 
>      memset(&msg, 0, sizeof(msg));
> 
> -    exe = virJSONValueObjectGet(cmd, "execute");
> +    exe = virJSONValueObjectGetObject(cmd, "execute");
>      if (exe) {
>          if (!(id = qemuMonitorNextCommandID(mon)))
>              goto cleanup;

This hunk is spurious (the 'execute' member is a string, not an object);
I've removed it locally from my tree.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150622/6d62357f/attachment-0001.sig>


More information about the libvir-list mailing list