diff options
author | Eric Blake | 2021-01-13 23:10:12 +0100 |
---|---|---|
committer | Markus Armbruster | 2021-01-28 08:08:45 +0100 |
commit | c3033fd372fdaf5b89190136a74b3d78880b85d6 (patch) | |
tree | 6c2464ae3f51b43702c448606acb3a6c21b6b634 /block/export | |
parent | qapi: Introduce QAPI_LIST_APPEND (diff) | |
download | qemu-c3033fd372fdaf5b89190136a74b3d78880b85d6.tar.gz qemu-c3033fd372fdaf5b89190136a74b3d78880b85d6.tar.xz qemu-c3033fd372fdaf5b89190136a74b3d78880b85d6.zip |
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>
Diffstat (limited to 'block/export')
-rw-r--r-- | block/export/export.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/block/export/export.c b/block/export/export.c index b716c1522c..fec7d9f738 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -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; |