From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com, armbru@redhat.com,
rjones@redhat.com, pkrempa@redhat.com, qemu-block@nongnu.org,
"Max Reitz" <mreitz@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Jiri Pirko" <jiri@resnulli.us>,
"Jason Wang" <jasowang@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Richard Henderson" <rth@twiddle.net>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Thomas Huth" <thuth@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"open list:GLUSTER" <integration@gluster.org>,
"open list:ARM TCG CPUs" <qemu-arm@nongnu.org>,
"open list:PowerPC TCG CPUs" <qemu-ppc@nongnu.org>,
"open list:S390 KVM CPUs" <qemu-s390x@nongnu.org>
Subject: Re: [PATCH v6 11/11] qapi: Use QAPI_LIST_ADD() where possible
Date: Tue, 27 Oct 2020 16:42:05 +0300 [thread overview]
Message-ID: <dd84c46b-916d-66b0-4e3f-23e4fa9a3f4d@virtuozzo.com> (raw)
In-Reply-To: <20201027050556.269064-12-eblake@redhat.com>
27.10.2020 08:05, Eric Blake wrote:
> Anywhere we create a list of just one item or by prepending items
> (typically because order doesn't matter), we can use the now-public
> macro. But places where we must keep the list in order by appending
> remain open-coded.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
[..]
>
> diff --git a/docs/devel/writing-qmp-commands.txt b/docs/devel/writing-qmp-commands.txt
> index 46a6c48683f5..3e11eeaa1893 100644
> --- a/docs/devel/writing-qmp-commands.txt
> +++ b/docs/devel/writing-qmp-commands.txt
> @@ -531,15 +531,10 @@ TimerAlarmMethodList *qmp_query_alarm_methods(Error **errp)
> bool current = true;
>
> for (p = alarm_timers; p->name; p++) {
> - TimerAlarmMethodList *info = g_malloc0(sizeof(*info));
> - info->value = g_malloc0(sizeof(*info->value));
> - info->value->method_name = g_strdup(p->name);
> - info->value->current = current;
> -
> - current = false;
You need to keep this line, otherwise logic is broken.
> -
> - info->next = method_list;
> - method_list = info;
> + TimerAlarmMethod *value = g_new0(TimerAlarmMethod, 1);
> + value->method_name = g_strdup(p->name);
> + value->current = current;
> + QAPI_LIST_ADD(method_list, value);
> }
>
> return method_list;
--
Best regards,
Vladimir
prev parent reply other threads:[~2020-10-27 13:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 5:05 [PATCH v6 00/11] Exposing backing-chain allocation over NBD Eric Blake
2020-10-27 5:05 ` [PATCH v6 01/11] block: Simplify QAPI_LIST_ADD Eric Blake
2020-10-27 10:06 ` Vladimir Sementsov-Ogievskiy
2020-10-27 12:58 ` Markus Armbruster
2020-10-27 5:05 ` [PATCH v6 02/11] qapi: Make QAPI_LIST_ADD() public Eric Blake
2020-10-27 5:05 ` [PATCH v6 03/11] nbd: Utilize QAPI_CLONE for type conversion Eric Blake
2020-10-27 5:05 ` [PATCH v6 04/11] nbd: Update qapi to support exporting multiple bitmaps Eric Blake
2020-10-27 10:29 ` Vladimir Sementsov-Ogievskiy
2020-10-27 12:37 ` Peter Krempa
2020-10-27 5:05 ` [PATCH v6 05/11] nbd: Simplify qemu bitmap context name Eric Blake
2020-10-27 5:05 ` [PATCH v6 06/11] nbd: Refactor counting of metadata contexts Eric Blake
2020-10-27 10:33 ` Vladimir Sementsov-Ogievskiy
2020-10-27 5:05 ` [PATCH v6 07/11] nbd: Allow export of multiple bitmaps for one device Eric Blake
2020-10-27 5:05 ` [PATCH v6 08/11] block: Return depth level during bdrv_is_allocated_above Eric Blake
2020-10-27 12:05 ` Vladimir Sementsov-Ogievskiy
2020-10-27 5:05 ` [PATCH v6 09/11] nbd: Add new qemu:allocation-depth metadata context Eric Blake
2020-10-27 10:53 ` Vladimir Sementsov-Ogievskiy
2020-10-27 5:05 ` [PATCH v6 10/11] nbd: Add 'qemu-nbd -A' to expose allocation depth Eric Blake
2020-10-27 11:03 ` Vladimir Sementsov-Ogievskiy
2020-10-27 5:05 ` [PATCH v6 11/11] qapi: Use QAPI_LIST_ADD() where possible Eric Blake
2020-10-27 5:53 ` Thomas Huth
2020-10-27 6:39 ` David Gibson
2020-10-27 10:09 ` Markus Armbruster
2020-10-27 12:28 ` Eric Blake
2020-10-27 15:36 ` Markus Armbruster
2020-10-27 18:44 ` Eric Blake
2020-10-27 11:26 ` Dr. David Alan Gilbert
2020-10-27 13:42 ` Vladimir Sementsov-Ogievskiy [this message]
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=dd84c46b-916d-66b0-4e3f-23e4fa9a3f4d@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=ehabkost@redhat.com \
--cc=f4bug@amsat.org \
--cc=integration@gluster.org \
--cc=jasowang@redhat.com \
--cc=jiaxun.yang@flygoat.com \
--cc=jiri@resnulli.us \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pkrempa@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=quintela@redhat.com \
--cc=rjones@redhat.com \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/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).