From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9uQM-0002TI-5u for qemu-devel@nongnu.org; Mon, 06 Jun 2016 09:18:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9uQG-0003yt-K0 for qemu-devel@nongnu.org; Mon, 06 Jun 2016 09:18:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9uQG-0003yZ-Eo for qemu-devel@nongnu.org; Mon, 06 Jun 2016 09:18:28 -0400 From: Igor Mammedov Date: Mon, 6 Jun 2016 15:18:23 +0200 Message-Id: <1465219103-253669-1-git-send-email-imammedo@redhat.com> In-Reply-To: <1465132825-14242-19-git-send-email-mst@redhat.com> References: <1465132825-14242-19-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PATCH 18/25] fixup! acpi: simplify bios_linker API by removing redundant 'table' argument List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, mst@redhat.com, zhaoshenglong@huawei.com, marcel@redhat.com replace glib 2.32 g_array_set_clear_func() with a manual cleanup loop Signed-off-by: Igor Mammedov --- hw/acpi/bios-linker-loader.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/acpi/bios-linker-loader.c b/hw/acpi/bios-linker-loader.c index a2f20ec..8e3f30d 100644 --- a/hw/acpi/bios-linker-loader.c +++ b/hw/acpi/bios-linker-loader.c @@ -105,12 +105,6 @@ typedef struct BiosLinkerFileEntry { GArray *blob; /* data accosiated with @name */ } BiosLinkerFileEntry; -static void bios_linker_free_file_entry(gpointer data) -{ - BiosLinkerFileEntry *entry = data; - g_free(entry->name); -} - /* * bios_linker_loader_init: allocate a new linker object instance. * @@ -124,15 +118,20 @@ BIOSLinker *bios_linker_loader_init(void) linker->cmd_blob = g_array_new(false, true /* clear */, 1); linker->file_list = g_array_new(false, true /* clear */, sizeof(BiosLinkerFileEntry)); - g_array_set_clear_func(linker->file_list, bios_linker_free_file_entry); return linker; } /* Free linker wrapper and return the linker commands array. */ void *bios_linker_loader_cleanup(BIOSLinker *linker) { + int i; + BiosLinkerFileEntry *entry; void *cmd_blob = g_array_free(linker->cmd_blob, false); + for (i = 0; i < linker->file_list->len; i++) { + entry = &g_array_index(linker->file_list, BiosLinkerFileEntry, i); + g_free(entry->name); + } g_array_free(linker->file_list, true); g_free(linker); return cmd_blob; -- 1.8.3.1