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 --- hw/acpi/memory_hotplug.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'hw/acpi/memory_hotplug.c') diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index f2552b2..0bdcf15 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -53,14 +53,12 @@ static ACPIOSTInfo *acpi_memory_device_status(int slot, MemStatus *mdev) void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list) { + ACPIOSTInfoList ***tail = list; int i; for (i = 0; i < mem_st->dev_count; i++) { - ACPIOSTInfoList *elem = g_new0(ACPIOSTInfoList, 1); - elem->value = acpi_memory_device_status(i, &mem_st->devs[i]); - elem->next = NULL; - **list = elem; - *list = &elem->next; + QAPI_LIST_APPEND(*tail, + acpi_memory_device_status(i, &mem_st->devs[i])); } } -- cgit v1.1