* [Qemu-devel] [PATCH for-1.7] acpi-build: fix support for glib < 2.22
@ 2013-11-25 22:00 Michael S. Tsirkin
0 siblings, 0 replies; only message in thread
From: Michael S. Tsirkin @ 2013-11-25 22:00 UTC (permalink / raw)
To: Anthony Liguori; +Cc: erik.rull, pbonzini, qemu-devel, rth
glib < 2.22 does not have g_array_get_element_size,
limit it's use (to check all elements are 1 byte
in size) to newer glib.
This fixes build on RHEL 5.3.
Reported-by: Richard Henderson <rth@redhat.com>
Reported-by: Erik Rull <erik.rull@rdsoftware.de>
Tested-by: Richard Henderson <rth@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/acpi-build.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 5f36e7e..1f22fb6 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -425,7 +425,7 @@ static inline void *acpi_data_push(GArray *table_data, unsigned size)
static unsigned acpi_data_len(GArray *table)
{
-#if GLIB_CHECK_VERSION(2, 14, 0)
+#if GLIB_CHECK_VERSION(2, 22, 0)
assert(g_array_get_element_size(table) == 1);
#endif
return table->len;
@@ -436,9 +436,7 @@ static void acpi_align_size(GArray *blob, unsigned align)
/* Align size to multiple of given size. This reduces the chance
* we need to change size in the future (breaking cross version migration).
*/
- g_array_set_size(blob, (ROUND_UP(acpi_data_len(blob), align) +
- g_array_get_element_size(blob) - 1) /
- g_array_get_element_size(blob));
+ g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
}
/* Get pointer within table in a safe manner */
--
MST
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-11-25 21:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-25 22:00 [Qemu-devel] [PATCH for-1.7] acpi-build: fix support for glib < 2.22 Michael S. Tsirkin
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).