qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v3 20/25] s390x/sclp: Use a const variable to improv


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] [PATCH v3 20/25] s390x/sclp: Use a const variable to improve readability
Date: Wed, 20 Feb 2019 02:02:27 +0100

We will reuse this variable in the next patch.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 hw/char/sclpconsole-lm.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
index dbc91a1e5b..49543e2c83 100644
--- a/hw/char/sclpconsole-lm.c
+++ b/hw/char/sclpconsole-lm.c
@@ -210,13 +210,14 @@ static int process_mdb(SCLPEvent *event, MDBO *mdbo)
     int rc;
     int len;
     uint8_t buffer[SIZE_BUFFER];
-
-    len = be16_to_cpu(mdbo->length);
-    len -= sizeof(mdbo->length) + sizeof(mdbo->type)
+    const size_t hlen = sizeof(mdbo->length)
+            + sizeof(mdbo->type)
             + sizeof(mdbo->mto.line_type_flags)
             + sizeof(mdbo->mto.alarm_control)
             + sizeof(mdbo->mto._reserved);
 
+    len = be16_to_cpu(mdbo->length);
+    len -= hlen;
     assert(len <= SIZE_BUFFER);
 
     /* convert EBCDIC SCLP contents to ASCII console message */
-- 
2.20.1




reply via email to

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