qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 02/11] acpi_table_add(): extract acpi_tables init to


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH 02/11] acpi_table_add(): extract acpi_tables init to separate function
Date: Wed, 27 Jun 2012 17:22:58 -0300

No behavior change, just code movement.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 hw/acpi.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/hw/acpi.c b/hw/acpi.c
index 21e573b..6180c7a 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -72,6 +72,15 @@ static void strzcpy(char *dst, const char *src, size_t size)
     memcpy(dst, src, len);
 }
 
+/* Init acpi_tables if necessary */
+static void init_acpi_tables(void)
+{
+    if (!acpi_tables) {
+        acpi_tables_len = sizeof(uint16_t);
+        acpi_tables = g_malloc0(acpi_tables_len);
+    }
+}
+
 /* XXX fixme: this function uses obsolete argument parsing interface */
 int acpi_table_add(const char *t)
 {
@@ -101,10 +110,7 @@ int acpi_table_add(const char *t)
         return -1;
     }
 
-    if (!acpi_tables) {
-        acpi_tables_len = sizeof(uint16_t);
-        acpi_tables = g_malloc0(acpi_tables_len);
-    }
+    init_acpi_tables();
 
     allen = acpi_tables_len;
     start = allen;
-- 
1.7.10.4




reply via email to

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