]> git.proxmox.com Git - qemu.git/blobdiff - hw/i386/acpi-build.c
acpi-build: fix support for glib < 2.22
[qemu.git] / hw / i386 / acpi-build.c
index 5f36e7ec020c364c85e829f5dec1019e1b1baaa1..1f22fb60a4bd6ce1b9572634389d3785aac5e98d 100644 (file)
@@ -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 */