aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/acpi-build.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2013-11-21 11:22:51 +0200
committerMichael S. Tsirkin <mst@redhat.com>2013-11-21 16:28:27 +0200
commitfd8f5e37557596e14a859d8edf3dc24523bd4400 (patch)
tree9ccb7cdb9b24b508c164a2a759d71e6c5fa15096 /hw/i386/acpi-build.c
parent8b9c3b897c682cd9739c6aef73b3220c7204c243 (diff)
acpi-build: fix build on glib < 2.14
g_array_get_element_size was only added in glib 2.14, there's no way to find element size in with an older glib. Fortunately we only use a single table (linker) where element size > 1. Switch element size to 1 everywhere, then we can just look at len field to get table size in bytes. Add an assert to make sure we catch any violations of this rule. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reported-by: Richard Henderson <rth@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386/acpi-build.c')
-rw-r--r--hw/i386/acpi-build.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 59a17dfbd3..5f36e7ec02 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -425,7 +425,10 @@ static inline void *acpi_data_push(GArray *table_data, unsigned size)
static unsigned acpi_data_len(GArray *table)
{
- return table->len * g_array_get_element_size(table);
+#if GLIB_CHECK_VERSION(2, 14, 0)
+ assert(g_array_get_element_size(table) == 1);
+#endif
+ return table->len;
}
static void acpi_align_size(GArray *blob, unsigned align)