qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL v2] pci, pc, virtio fixes and cleanups


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PULL v2] pci, pc, virtio fixes and cleanups
Date: Tue, 3 Mar 2015 17:40:31 +0100

On Tue, Mar 03, 2015 at 03:44:29PM +0100, Paolo Bonzini wrote:
> 
> 
> On 03/03/2015 15:37, Peter Maydell wrote:
> > Doesn't build with our minimum glib requirement, I'm afraid:
> > 
> > /home/petmay01/linaro/qemu-for-merges/hw/acpi/aml-build.c:313:
> > undefined reference to `g_ptr_array_new_with_free_func'
> > 
> > (that function only appeared in glib 2.22.)
> 
> >From a few weeks ago:
> 
> > Moving beyond 2.22 would be awkward for me in that my OSX
> > box only has 2.22 because fink doesn't have anything newer.
> > I could probably deal with that somehow (switching to some
> > other package system, probably).
> > 
> > Debian stable is "2.33.12+really2.32.4-5" and oldstable
> > is "2.24.2-1" (and if my googling is right is an LTS release).
> > 
> > Ubuntu Lucid (LTS release) is 2.24; Precise (also LTS)
> > is 2.32.
> > 
> > Daniel says RHEL6 has 2.28.
> > 
> > That suggests to me that we could reasonably advance to
> > 2.22 or 2.24 if it seemed beneficial, but not beyond that.
> > Is there anything particularly worthwhile that would get us?
> 
> Maybe we have a candidate now.  That function doesn't seem easy to
> replace, and it is pretty useful.
> 
> Paolo


It's my mistake.
It does seem trivial to replace:

-->

aml-build: fix build for glib < 2.22

g_ptr_array_new_with_free_func is there since glib 2.22,
use the older g_ptr_array_foreach instead.

Signed-off-by: Michael S. Tsirkin <address@hidden>

---

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 3e5949b..f46c96c 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;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]