qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Michael Roth <michael.roth@amd.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH v3 5/7] qapi: Introduce QAPI_LIST_APPEND
Date: Wed, 13 Jan 2021 08:08:45 -0600	[thread overview]
Message-ID: <cbda6c17-ff87-1937-ee11-fb66aa1053af@redhat.com> (raw)
In-Reply-To: <877doh0z01.fsf@dusky.pond.sub.org>

On 1/13/21 7:04 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>
>> ---
>>  include/qapi/util.h | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/include/qapi/util.h b/include/qapi/util.h
>> index 6178e98e97a5..8b4967990c0d 100644
>> --- a/include/qapi/util.h
>> +++ b/include/qapi/util.h
>> @@ -37,4 +37,17 @@ int parse_qapi_name(const char *name, bool complete);
>>      (list) = _tmp; \
>>  } while (0)
>>
>> +/*
>> + * For any pointer to a GenericList @tail, insert @element at the back and
>> + * update the tail.
>> + *
>> + * Note that this macro evaluates @element exactly once, so it is safe
>> + * to have side-effects with that argument.
>> + */
>> +#define QAPI_LIST_APPEND(tail, element) do { \
>> +    *(tail) = g_malloc0(sizeof(**(tail))); \
>> +    (*(tail))->value = (element); \
>> +    (tail) = &(*tail)->next; \
>> +} while (0)
>> +
>>  #endif
> 
> You mentioned parenthesizing the lone unparenthesized occurence of
> @tail, like
> 
>   +    (tail) = &(*(tail))->next; \
> 
> Did you decide not to?

Hmm; not sure what happened. I still want the () added.  I'll respin
anyways, since my v3 crossed paths with what you already checked in.

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



  reply	other threads:[~2021-01-13 14:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23 22:10 [PATCH v3 0/7] Common macros for QAPI list growth Eric Blake
2020-12-23 22:10 ` [PATCH v3 1/7] net: Clarify early exit condition Eric Blake
2021-01-13 12:57   ` Markus Armbruster
2020-12-23 22:10 ` [PATCH v3 2/7] rocker: Revamp fp_port_get_info Eric Blake
2021-01-13 12:57   ` Markus Armbruster
2020-12-23 22:10 ` [PATCH v3 3/7] migration: Refactor migrate_cap_add Eric Blake
2021-01-13 12:58   ` Markus Armbruster
2020-12-23 22:10 ` [PATCH v3 4/7] qapi: Use QAPI_LIST_PREPEND() where possible Eric Blake
2021-01-13 13:00   ` Markus Armbruster
2020-12-23 22:11 ` [PATCH v3 5/7] qapi: Introduce QAPI_LIST_APPEND Eric Blake
2020-12-24  6:14   ` Vladimir Sementsov-Ogievskiy
2021-01-13 13:04   ` Markus Armbruster
2021-01-13 14:08     ` Eric Blake [this message]
2020-12-23 22:11 ` [PATCH v3 6/7] qapi: Use QAPI_LIST_APPEND in trivial cases Eric Blake
2020-12-24  9:56   ` Vladimir Sementsov-Ogievskiy
2021-01-13 14:10     ` Eric Blake
2021-01-13 13:16   ` Markus Armbruster
2021-01-13 14:11     ` Eric Blake
2020-12-23 22:11 ` [PATCH v3 7/7] qapi: More complex uses of QAPI_LIST_APPEND Eric Blake
2020-12-24 11:35   ` Vladimir Sementsov-Ogievskiy
2021-01-13 13:31   ` 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=cbda6c17-ff87-1937-ee11-fb66aa1053af@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=michael.roth@amd.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).