qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v6 09/23] hmp: Improve use of qapi visitor


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v6 09/23] hmp: Improve use of qapi visitor
Date: Fri, 4 Dec 2015 14:18:55 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 11/25/2015 05:23 PM, Eric Blake wrote:
> Cache the visitor in a local variable instead of repeatedly
> calling the accessor.  Pass NULL for the visit_start_struct()
> object (which matches the fact that we were already passing 0
> for the size argument, because we aren't using the visit to
> allocate a qapi struct).  Pass "object" for the struct name,
> for better error messages. Reflow the logic so that we don't
> have to undo an object_add().
> 
> A later patch will then split the error detection currently
> in visit_struct_end(), at which point we can again hoist the
> object_add() to occur before the label as one of the cleanups
> enabled by that split.
> 
> Signed-off-by: Eric Blake <address@hidden>
> 

> 
> -    object_add(type, id, pdict, opts_get_visitor(ov), &err);
> -
>  out_end:
> -    visit_end_struct(opts_get_visitor(ov), &err_end);
> -    if (!err && err_end) {
> -        qmp_object_del(id, NULL);
> +    visit_end_struct(v, &err_end);
> +    if (!err && !err_end) {
> +        object_add(type, id, pdict, v, &err);
>      }

The attempt to avoid a qmp_object_del() cleanup on error was honorable,
but wrong.  Calling visit_end_struct() prior to passing 'v' to
object_add() means that object_add() is now visiting a different level
of {} than it was pre-patch, which showed up as a testsuite breakage
under 'make check-qtest'.  I'm reworking this patch (and the similar
change to vl.c in 10/23) for v7.

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]