qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 25/28] qapi: Make input visitors detect unvisited list tails
Date: Fri, 3 Mar 2017 14:01:53 -0600	[thread overview]
Message-ID: <c88da759-43c8-483e-1c22-e6b82d1848e7@redhat.com> (raw)
In-Reply-To: <87zih2i1hn.fsf@dusky.pond.sub.org>

[-- Attachment #1: Type: text/plain, Size: 2548 bytes --]

On 03/03/2017 01:50 PM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
>> On 03/03/2017 06:32 AM, Markus Armbruster wrote:
>>> Fix the design flaw demonstrated in the previous commit: new method
>>> check_list() lets input visitors report that unvisited input remains
>>> for a list, exactly like check_struct() lets them report that
>>> unvisited input remains for a struct or union.
>>>
>>> Implement the method for the qobject input visitor (straightforward),
>>> and the string input visitor (less so, due to the magic list syntax
>>> there).  The opts visitor's list magic is even more impenetrable, and
>>> all I can do there today is a stub with a FIXME comment.  No worse
>>> than before.
>>>
>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>> ---
>>
>> Didn't I already review this one?
>>
>> Ah, there's my R-b:
>> https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg07614.html
> 

>>> 
>>> --- a/qapi/qobject-input-visitor.c
>>> +++ b/qapi/qobject-input-visitor.c
>>> @@ -51,7 +51,8 @@ static QObjectInputVisitor *to_qiv(Visitor *v)
>>>      return container_of(v, QObjectInputVisitor, visitor);
>>>  }
>>>  
>>> -static const char *full_name(QObjectInputVisitor *qiv, const char *name)
>>> +static const char *full_name_nth(QObjectInputVisitor *qiv, const char *name,
>>> +                                 int n)
>>>  {

No function comment, so the _nth and int n are guesses on their meaning...


>> If I'm reading this right, your use of n-- in the loop followed by the
>> post-condition is to assert that QSLIST_FOREACH() iterated n times, but
>> lets see what callers pass for n:
> 
> At least @n times.

Ah, as in 'use first available result' or 'iterate at least once', based
on our callers, but could also mean 'iterate at least twice' for a
caller that passes 2.


>> the other passes 1.  No other calls.  Did we really need an integer,
>> where we use n--, or would a bool have done as well?
> 
> Since I actually use only 0 and 1, a bool would do, but would it make
> the code simpler?

I don't know that a bool would be any simpler,

> 
>> At any rate, since I've already reviewed it once, you can add R-b, but
>> we may want a followup to make it less confusing.
> 
> Would renaming the function to full_name_but_n() help?

Or even keep the name unchanged, but add function comments describing
what 'n' means.

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2017-03-03 20:02 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 12:32 [Qemu-devel] [PATCH v4 00/28] qapi: QMP dispatch and input visitor work Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 01/28] qga: Fix crash on non-dictionary QMP argument Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 02/28] libqtest: Work around a "QMP wants a newline" bug Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 03/28] qmp-test: New, covering basic QMP protocol Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 04/28] qmp: Dumb down how we run QMP command registration Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 05/28] qapi: Support multiple command registries per program Markus Armbruster
2017-03-03 18:24   ` Eric Blake
2017-03-03 19:37     ` Markus Armbruster
2017-03-03 19:52       ` Eric Blake
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 06/28] qapi-introspect: Mangle --prefix argument properly for C Markus Armbruster
2017-03-03 18:29   ` Eric Blake
2017-03-03 19:41     ` Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 07/28] qmp: Clean up how we enforce capability negotiation Markus Armbruster
2017-03-03 18:40   ` Eric Blake
2017-03-03 19:45     ` Markus Armbruster
2017-03-03 19:57       ` Eric Blake
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 08/28] qmp: Drop duplicated QMP command object checks Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 09/28] qmp: Eliminate silly QERR_QMP_* macros Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 10/28] qmp: Improve QMP dispatch error messages Markus Armbruster
2017-03-03 19:55   ` Philippe Mathieu-Daudé
2017-03-05  8:01     ` Markus Armbruster
2017-03-06 16:10       ` Eric Blake
2017-03-07  7:45         ` Markus Armbruster
2017-03-07 14:21       ` Eric Blake
2017-03-07 14:26         ` Philippe Mathieu-Daudé
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 11/28] qapi: Improve a QObject input visitor error message Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 12/28] qapi: Clean up after commit 3d344c2 Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 13/28] qapi: Make QObject input visitor set *list reliably Markus Armbruster
2017-03-03 19:57   ` Philippe Mathieu-Daudé
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 14/28] qapi: Improve qobject input visitor error reporting Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 15/28] qapi: Drop string input visitor method optional() Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 16/28] qapi: Make string input and opts visitor require non-null input Markus Armbruster
2017-03-06 17:07   ` Philippe Mathieu-Daudé
2017-03-07  7:47     ` Markus Armbruster
2017-03-07 12:17       ` Philippe Mathieu-Daudé
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 17/28] qom: Make object_property_set_qobject()'s input visitor strict Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 18/28] test-qobject-input-visitor: Use strict visitor Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 19/28] qapi: Drop unused non-strict qobject input visitor Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 20/28] tests-qobject-input-strict: Merge into test-qobject-input-visitor Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 21/28] test-string-input-visitor: Tear down existing test automatically Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 22/28] test-string-input-visitor: Improve list coverage Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 23/28] tests: Cover partial input visit of list Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 24/28] test-qobject-input-visitor: Cover missing nested struct member Markus Armbruster
2017-03-03 18:45   ` Eric Blake
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 25/28] qapi: Make input visitors detect unvisited list tails Markus Armbruster
2017-03-03 19:15   ` Eric Blake
2017-03-03 19:50     ` Markus Armbruster
2017-03-03 20:01       ` Eric Blake [this message]
2017-03-05  8:06         ` Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 26/28] tests: Cover input visit beyond end of list Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 27/28] qapi: Fix object " Markus Armbruster
2017-03-03 12:32 ` [Qemu-devel] [PATCH v4 28/28] qapi: Improve qobject visitor documentation Markus Armbruster
2017-03-03 12:58 ` [Qemu-devel] [PATCH v4 00/28] qapi: QMP dispatch and input visitor work no-reply

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=c88da759-43c8-483e-1c22-e6b82d1848e7@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).