From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl49u-0003Uu-L5 for qemu-devel@nongnu.org; Mon, 25 Nov 2013 16:57:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vl49p-0000EU-Lk for qemu-devel@nongnu.org; Mon, 25 Nov 2013 16:57:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4645) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl49p-0000EN-E1 for qemu-devel@nongnu.org; Mon, 25 Nov 2013 16:57:29 -0500 Date: Tue, 26 Nov 2013 00:00:39 +0200 From: "Michael S. Tsirkin" Message-ID: <20131125220039.GA16386@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH for-1.7] acpi-build: fix support for glib < 2.22 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: erik.rull@rdsoftware.de, pbonzini@redhat.com, qemu-devel@nongnu.org, rth@redhat.com 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 Reported-by: Erik Rull Tested-by: Richard Henderson Signed-off-by: Michael S. Tsirkin --- 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