All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, marcandre.lureau@redhat.com,
	mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max
Date: Thu, 24 Aug 2017 13:56:25 -0500	[thread overview]
Message-ID: <0b31fbbe-1d6e-09d5-6f0d-8f55af18e08f@redhat.com> (raw)
In-Reply-To: <87y3q8ddbb.fsf@dusky.pond.sub.org>

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

On 08/24/2017 01:35 PM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
>> On 08/24/2017 03:45 AM, Markus Armbruster wrote:
>>> The lookup tables have a sentinel, no need to make callers pass their
>>> size.
>>>
>>> Fun: the header has it in the wrong position.  Good riddance.
>>>

>>> +++ b/include/qapi/util.h
>>> @@ -12,7 +12,7 @@
>>>  #define QAPI_UTIL_H
>>>  
>>>  int qapi_enum_parse(const char * const lookup[], const char *buf,
>>> -                    int max, int def, Error **errp);
>>> +                    int def, Error **errp);
>>
>> I'm not sure what you meant by wrong position; were you thinking that
>> lookup/max should be immediately adjacent (since max is a property of
>> the lookup[] parameter), and sticking 'buf' in between the two is what
>> meant 'max' was in the wrong position?
> 
> Compare the declaration above with the definition below:
> 
>     diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
>     index 46eda7d..ee7594f 100644
>     --- a/qapi/qapi-util.c
>     +++ b/qapi/qapi-util.c
>     @@ -16,7 +16,7 @@
>      #include "qapi/util.h"
> 
>      int qapi_enum_parse(const char * const lookup[], const char *buf,
>     -                    int max, int def, Error **errp)
>     +                    int def, Error **errp)
>      {
>          int i;
> 
> Declaration has max before def, definition has it the other way round.

Huh?  On current master (commit 248b2373), the two look like they match
to me:

$ git grep -A1 qapi_enum_parse'.*const look'
include/qapi/util.h:int qapi_enum_parse(const char * const lookup[],
const char *buf,
include/qapi/util.h-                    int max, int def, Error **errp);
--
qapi/qapi-util.c:int qapi_enum_parse(const char * const lookup[], const
char *buf,
qapi/qapi-util.c-                    int max, int def, Error **errp)


> 
> Such errors are one reason I prefer to have documentation next to
> definitions, which are authoritative, rather than declarations, which
> may or may not match the definition.
> 
>> The change itself is reasonable, even if the commit message needs a
>> tweak to answer my question.
> 
> Care to suggest a wording?

At this point, I find the claim to be bogus, so I suggest you delete the
'Fun:' paragraph.

> 
>> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> Thanks!
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


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

  reply	other threads:[~2017-08-24 18:56 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
2017-08-24  8:45 ` [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code Markus Armbruster
2017-08-24 10:43   ` Marc-André Lureau
2017-08-24 16:32   ` Eric Blake
2017-08-24 18:29     ` Markus Armbruster
2017-08-24  8:45 ` [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max Markus Armbruster
2017-08-24 10:45   ` Marc-André Lureau
2017-08-24 16:38   ` Eric Blake
2017-08-24 18:35     ` Markus Armbruster
2017-08-24 18:56       ` Eric Blake [this message]
2017-08-24 19:24         ` Markus Armbruster
2017-08-24  8:45 ` [Qemu-devel] [PATCH 03/16] tpm: Clean up driver registration & lookup Markus Armbruster
2017-08-24  8:45 ` [Qemu-devel] [PATCH 04/16] tpm: Clean up model " Markus Armbruster
2017-08-24 10:50   ` Marc-André Lureau
2017-08-24 18:35     ` Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 05/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_capability() Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 06/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_parameter() Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 07/16] block: Use qemu_enum_parse() in blkdebug_debug_breakpoint() Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 08/16] quorum: Use qapi_enum_parse() in quorum_open() Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup() Markus Armbruster
2017-08-24 10:53   ` Marc-André Lureau
2017-08-29 11:10   ` Daniel P. Berrange
2017-08-24  8:46 ` [Qemu-devel] [PATCH 10/16] qapi: Use qapi_enum_parse() in input_type_enum() Markus Armbruster
2017-08-24 11:30   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 11/16] qapi: Avoid unnecessary use of enum lookup table's sentinel Markus Armbruster
2017-08-24 11:34   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 12/16] qapi: Generate FOO_str() macro for QAPI enum FOO Markus Armbruster
2017-08-30 13:42   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 13/16] qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) Markus Armbruster
2017-08-24 11:52   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 14/16] qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup() Markus Armbruster
2017-08-24 12:02   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO Markus Armbruster
2017-08-24  9:55   ` Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 16/16] qapi: drop the sentinel in enum array Markus Armbruster
2017-08-24  9:22 ` [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string no-reply
2017-09-01 12:43 ` 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=0b31fbbe-1d6e-09d5-6f0d-8f55af18e08f@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=marcandre.lureau@redhat.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.