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:
Eric Blake
2021-01-13 16:10:12 -06:00
committed by Markus Armbruster
parent dc13f40c6b
commit c3033fd372
20 changed files with 96 additions and 222 deletions

View File

@@ -2856,7 +2856,7 @@ static ImageInfoList *collect_image_info_list(bool image_opts,
bool chain, bool force_share)
{
ImageInfoList *head = NULL;
ImageInfoList **last = &head;
ImageInfoList **tail = &head;
GHashTable *filenames;
Error *err = NULL;
@@ -2866,7 +2866,6 @@ static ImageInfoList *collect_image_info_list(bool image_opts,
BlockBackend *blk;
BlockDriverState *bs;
ImageInfo *info;
ImageInfoList *elem;
if (g_hash_table_lookup_extended(filenames, filename, NULL, NULL)) {
error_report("Backing file '%s' creates an infinite loop.",
@@ -2890,10 +2889,7 @@ static ImageInfoList *collect_image_info_list(bool image_opts,
goto err;
}
elem = g_new0(ImageInfoList, 1);
elem->value = info;
*last = elem;
last = &elem->next;
QAPI_LIST_APPEND(tail, info);
blk_unref(blk);