* [Qemu-devel] [PATCH] aml-build: fix build for glib < 2.22
@ 2015-03-03 16:43 Michael S. Tsirkin
2015-03-03 16:56 ` Igor Mammedov
0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2015-03-03 16:43 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov
g_ptr_array_new_with_free_func is there since glib 2.22,
use the older g_ptr_array_foreach instead.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Seems to work ok here.
Igor - can you pls confirm?
hw/acpi/aml-build.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 3e5949b..876cada 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -299,7 +299,7 @@ static Aml *aml_bundle(uint8_t op, AmlBlockFlags flags)
return var;
}
-static void aml_free(gpointer data)
+static void aml_free(gpointer data, gpointer user_data)
{
Aml *var = data;
build_free_array(var->buf);
@@ -310,13 +310,14 @@ Aml *init_aml_allocator(void)
Aml *var;
assert(!alloc_list);
- alloc_list = g_ptr_array_new_with_free_func(aml_free);
+ alloc_list = g_ptr_array_new();
var = aml_alloc();
return var;
}
void free_aml_allocator(void)
{
+ g_ptr_array_foreach(alloc_list, aml_free, NULL);
g_ptr_array_free(alloc_list, true);
alloc_list = 0;
}
--
MST
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] aml-build: fix build for glib < 2.22
2015-03-03 16:43 [Qemu-devel] [PATCH] aml-build: fix build for glib < 2.22 Michael S. Tsirkin
@ 2015-03-03 16:56 ` Igor Mammedov
0 siblings, 0 replies; 2+ messages in thread
From: Igor Mammedov @ 2015-03-03 16:56 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Peter Maydell, qemu-devel
On Tue, 3 Mar 2015 17:43:30 +0100
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> g_ptr_array_new_with_free_func is there since glib 2.22,
> use the older g_ptr_array_foreach instead.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
>
> Seems to work ok here.
> Igor - can you pls confirm?
>
> hw/acpi/aml-build.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 3e5949b..876cada 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -299,7 +299,7 @@ static Aml *aml_bundle(uint8_t op, AmlBlockFlags flags)
> return var;
> }
>
> -static void aml_free(gpointer data)
> +static void aml_free(gpointer data, gpointer user_data)
> {
> Aml *var = data;
> build_free_array(var->buf);
> @@ -310,13 +310,14 @@ Aml *init_aml_allocator(void)
> Aml *var;
>
> assert(!alloc_list);
> - alloc_list = g_ptr_array_new_with_free_func(aml_free);
> + alloc_list = g_ptr_array_new();
> var = aml_alloc();
> return var;
> }
>
> void free_aml_allocator(void)
> {
> + g_ptr_array_foreach(alloc_list, aml_free, NULL);
> g_ptr_array_free(alloc_list, true);
> alloc_list = 0;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-03 16:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 16:43 [Qemu-devel] [PATCH] aml-build: fix build for glib < 2.22 Michael S. Tsirkin
2015-03-03 16:56 ` Igor Mammedov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).