[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v15 10/23] qmp-input: Require struct push to vis
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v15 10/23] qmp-input: Require struct push to visit members of top dict |
Date: |
Thu, 28 Apr 2016 09:04:29 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 04/28/2016 09:00 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
>
>> Don't embed the root of the visit into the stack of current
>> containers being visited. That way, we no longer get confused
>> on whether the first visit of a dictionary is to the dictionary
>> itself or to one of the members of the dictionary, based on
>> whether the caller passed name=NULL; and makes the QMP Input
>> visitor like other visitors where the value of 'name' is now
>> ignored on the root visit. (We may someday want to revisit
>> the rules on what 'name' should be on a top-level visit,
>> rather than just ignoring it; but that would be the topic of
>> another patch).
>>
>> An audit of all qmp_input_visitor_new() call sites shows that
>> there were only two places where callers had previously been
>> visiting to a QDict with a non-NULL name to bypass a call to
>> visit_start_struct(), and those were fixed in prior patches.
>>
>> Signed-off-by: Eric Blake <address@hidden>
>>
>> ---
>> @@ -54,33 +56,34 @@ static QObject *qmp_input_get_object(QmpInputVisitor
>> *qiv,
>> const char *name,
>> bool consume)
>> {
>> - StackObject *tos = &qiv->stack[qiv->nb_stack - 1];
>> - QObject *qobj = tos->obj;
>> - QObject *ret;
>> + StackObject *tos;
>> + QObject *qobj;
>> + QObject *ret = NULL;
>
> Dead initializer?
>
Probably a rebase artifact.
>> + if (qobject_type(qobj) == QTYPE_QDICT) {
>> + assert(name);
>> ret = qdict_get(qobject_to_qdict(qobj), name);
...
>> + } else {
>> assert(qobject_type(qobj) == QTYPE_QLIST);
>> - return qlist_entry_obj(tos->entry);
>> + assert(!name);
>> + ret = qlist_entry_obj(tos->entry);
It does indeed get set on all branches, so the initializer can be dropped.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v15 05/23] qapi: Use strict QMP input visitor in more places, (continued)
[Qemu-devel] [PATCH v15 01/23] qapi-visit: Add visitor.type classification, Eric Blake, 2016/04/27
[Qemu-devel] [PATCH v15 10/23] qmp-input: Require struct push to visit members of top dict, Eric Blake, 2016/04/27
[Qemu-devel] [PATCH v15 15/23] qmp: Support explicit null during visits, Eric Blake, 2016/04/27
[Qemu-devel] [PATCH v15 12/23] qapi: Document visitor interfaces, add assertions, Eric Blake, 2016/04/27
[Qemu-devel] [PATCH v15 18/23] qmp: Tighten output visitor rules, Eric Blake, 2016/04/27
[Qemu-devel] [PATCH v15 17/23] qmp: Add qmp_output_visitor_reset(), Eric Blake, 2016/04/27
[Qemu-devel] [PATCH v15 20/23] tests/string-input-visitor: Add negative integer tests, Eric Blake, 2016/04/27
[Qemu-devel] [PATCH v15 21/23] qapi: Fix string input visitor handling of invalid list, Eric Blake, 2016/04/27