qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 04/11] acpi_table_add(): introduce 'qemu_len' variab


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH 04/11] acpi_table_add(): introduce 'qemu_len' variable
Date: Wed, 27 Jun 2012 17:23:00 -0300

To make the length calculation clearer, introduce a 'qemu_len' variable,
for the length of all data being added to acpi_tables (including the
QEMU-specific prefix).

No behavior change, just make the length calculation clearer.

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

diff --git a/hw/acpi.c b/hw/acpi.c
index abc959e..b5f0531 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -86,7 +86,8 @@ int acpi_table_add(const char *t)
 {
     char buf[1024], *p, *f;
     unsigned long val;
-    size_t acpi_len, start, allen;
+    size_t start, allen;
+    size_t qemu_len, acpi_len;
     bool has_header;
     int changed;
     int r;
@@ -150,13 +151,17 @@ int acpi_table_add(const char *t)
     /* now fill in the header fields */
 
     f = acpi_tables + start;   /* start of the table */
+
+    /* length of the whole table, including our prefix */
+    qemu_len = allen - start;
+
     changed = 0;
 
     /* copy the header to temp place to align the fields */
     memcpy(&hdr, has_header ? f : dfl_hdr, ACPI_TABLE_HDR_SIZE);
 
     /* length of the table minus our prefix */
-    acpi_len = allen - start - ACPI_TABLE_PFX_SIZE;
+    acpi_len = qemu_len - ACPI_TABLE_PFX_SIZE;
 
     hdr._length = cpu_to_le16(acpi_len);
 
-- 
1.7.10.4




reply via email to

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