From c3033fd372fdaf5b89190136a74b3d78880b85d6 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 13 Jan 2021 16:10:12 -0600 Subject: 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 Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Markus Armbruster Message-Id: <20210113221013.390592-5-eblake@redhat.com> Signed-off-by: Markus Armbruster --- qemu-img.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'qemu-img.c') diff --git a/qemu-img.c b/qemu-img.c index 8597d06..e2952fe 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -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); -- cgit v1.1