From: Markus Armbruster <armbru@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 4/4] qobject-input-visitor: Catch misuse of end_struct vs. end_list
Date: Thu, 27 Apr 2017 12:49:24 +0200 [thread overview]
Message-ID: <8760hqceh7.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAJ+F1CL2=cjEJ40tJ0nKtWD=DbG9aAmFkoRDT2y0+zaHFZbe0w@mail.gmail.com> ("Marc-André Lureau"'s message of "Thu, 27 Apr 2017 09:06:44 +0000")
Marc-André Lureau <marcandre.lureau@gmail.com> writes:
> On Thu, Apr 27, 2017 at 12:41 PM Markus Armbruster <armbru@redhat.com>
> wrote:
>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>
>
> It would be more obvious with a check for qobject_type(tos->obj), no?
--verbose?
> In any case:
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Thanks!
>> ---
>> qapi/qobject-input-visitor.c | 21 +++++++++++++++++++--
>> 1 file changed, 19 insertions(+), 2 deletions(-)
>>
>> diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
>> index 2530959..68a6742 100644
>> --- a/qapi/qobject-input-visitor.c
>> +++ b/qapi/qobject-input-visitor.c
>> @@ -291,6 +291,15 @@ static void qobject_input_start_struct(Visitor *v,
>> const char *name, void **obj,
>> }
>> }
>>
>> +static void qobject_input_end_struct(Visitor *v, void **obj)
>> +{
>> + QObjectInputVisitor *qiv = to_qiv(v);
>> + StackObject *tos = QSLIST_FIRST(&qiv->stack);
>> +
>> + assert(tos->h);
>> + qobject_input_pop(v, obj);
>> +}
>> +
>>
>> static void qobject_input_start_list(Visitor *v, const char *name,
>> GenericList **list, size_t size,
>> @@ -346,6 +355,14 @@ static void qobject_input_check_list(Visitor *v,
>> Error **errp)
>> }
>> }
>>
>> +static void qobject_input_end_list(Visitor *v, void **obj)
>> +{
>> + QObjectInputVisitor *qiv = to_qiv(v);
>> + StackObject *tos = QSLIST_FIRST(&qiv->stack);
>> +
>> + assert(!tos->h);
>> + qobject_input_pop(v, obj);
>> +}
>>
>> static void qobject_input_start_alternate(Visitor *v, const char *name,
>> GenericAlternate **obj, size_t
>> size,
>> @@ -645,11 +662,11 @@ static QObjectInputVisitor
>> *qobject_input_visitor_base_new(QObject *obj)
>> v->visitor.type = VISITOR_INPUT;
>> v->visitor.start_struct = qobject_input_start_struct;
>> v->visitor.check_struct = qobject_input_check_struct;
>> - v->visitor.end_struct = qobject_input_pop;
>> + v->visitor.end_struct = qobject_input_end_struct;
>> v->visitor.start_list = qobject_input_start_list;
>> v->visitor.next_list = qobject_input_next_list;
>> v->visitor.check_list = qobject_input_check_list;
>> - v->visitor.end_list = qobject_input_pop;
>> + v->visitor.end_list = qobject_input_end_list;
>> v->visitor.start_alternate = qobject_input_start_alternate;
>> v->visitor.optional = qobject_input_optional;
>> v->visitor.free = qobject_input_free;
>> --
>> 2.7.4
>>
>>
>> --
> Marc-André Lureau
next prev parent reply other threads:[~2017-04-27 10:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-27 8:41 [Qemu-devel] [PATCH 0/4] qapi: Loose ends Markus Armbruster
2017-04-27 8:41 ` [Qemu-devel] [PATCH 1/4] qmp: Improve QMP dispatch error messages Markus Armbruster
2017-04-27 9:06 ` Marc-André Lureau
2017-05-02 13:14 ` Philippe Mathieu-Daudé
2017-04-27 8:41 ` [Qemu-devel] [PATCH 2/4] qobject-input-visitor: Document full_name_nth() Markus Armbruster
2017-04-27 9:06 ` Marc-André Lureau
2017-04-27 8:41 ` [Qemu-devel] [PATCH 3/4] qapi: Document intended use of @name within alternate visits Markus Armbruster
2017-04-27 9:06 ` Marc-André Lureau
2017-04-27 8:41 ` [Qemu-devel] [PATCH 4/4] qobject-input-visitor: Catch misuse of end_struct vs. end_list Markus Armbruster
2017-04-27 9:06 ` Marc-André Lureau
2017-04-27 10:49 ` Markus Armbruster [this message]
2017-04-27 10:56 ` Marc-André Lureau
2017-04-27 11:50 ` Markus Armbruster
2017-04-27 13:13 ` Eric Blake
2017-04-27 14:02 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8760hqceh7.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.