mirror of
https://github.com/qemu/qemu.git
synced 2026-05-17 15:39:58 +00:00
qapi: Use QAPI_LIST_APPEND in trivial cases
The easiest spots to use QAPI_LIST_APPEND are where we already have an obvious pointer to the tail of a list. While at it, consistently use the variable name 'tail' for that purpose. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210113221013.390592-5-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
committed by
Markus Armbruster
parent
dc13f40c6b
commit
c3033fd372
@@ -342,11 +342,10 @@ void qmp_block_export_del(const char *id,
|
||||
|
||||
BlockExportInfoList *qmp_query_block_exports(Error **errp)
|
||||
{
|
||||
BlockExportInfoList *head = NULL, **p_next = &head;
|
||||
BlockExportInfoList *head = NULL, **tail = &head;
|
||||
BlockExport *exp;
|
||||
|
||||
QLIST_FOREACH(exp, &block_exports, next) {
|
||||
BlockExportInfoList *entry = g_new0(BlockExportInfoList, 1);
|
||||
BlockExportInfo *info = g_new(BlockExportInfo, 1);
|
||||
*info = (BlockExportInfo) {
|
||||
.id = g_strdup(exp->id),
|
||||
@@ -355,9 +354,7 @@ BlockExportInfoList *qmp_query_block_exports(Error **errp)
|
||||
.shutting_down = !exp->user_owned,
|
||||
};
|
||||
|
||||
entry->value = info;
|
||||
*p_next = entry;
|
||||
p_next = &entry->next;
|
||||
QAPI_LIST_APPEND(tail, info);
|
||||
}
|
||||
|
||||
return head;
|
||||
|
||||
Reference in New Issue
Block a user