qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 5/7] qapi: Introduce QAPI_LIST_APPEND


From: Markus Armbruster
Subject: Re: [PATCH v2 5/7] qapi: Introduce QAPI_LIST_APPEND
Date: Wed, 18 Nov 2020 07:21:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Eric Blake <eblake@redhat.com> writes:

> On 11/17/20 6:51 AM, Markus Armbruster wrote:
>> Eric Blake <eblake@redhat.com> writes:
>> 
>>> Similar to the existing QAPI_LIST_PREPEND, but designed for use where
>>> we want to preserve insertion order.  Callers will be added in
>>> upcoming patches.  Note the difference in signature: PREPEND takes
>>> List*, APPEND takes List**.
>>>
>>> Signed-off-by: Eric Blake <eblake@redhat.com>
>
>>> +#define QAPI_LIST_APPEND(tail, element) do { \
>>> +    *(tail) = g_malloc0(sizeof(**(tail))); \
>>> +    (*(tail))->value = (element); \
>>> +    (tail) = &(*tail)->next; \
>
> Hmm; I'm inconsistent on whether to spell things '*tail' or '*(tail)'.
> I don't think any of the callers converted in patches 6 or 7 care about
> the difference, but for maximal copy-paste portability, the use of the
> macro parameter should be surrounded by () anywhere that could otherwise
> cause a mis-parse on some arbitrary expression with an operator at
> higher precedence than unary * (hmm, the only such operators are all
> suffix operators; so maybe the *(tail) is overkill...)

Good habit: enclose macro parameter in parenthesis unless there is a
reason not to.  Let's do it here, too.

>> Reviewed-by: Markus Armbruster <armbru@redhat.com>




reply via email to

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