qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 13/14] monitor: Clean up handle_hmp_command() a bit


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH 13/14] monitor: Clean up handle_hmp_command() a bit
Date: Fri, 17 Feb 2017 21:38:24 +0100

Leave checking qobject_type(req) to qmp_check_input_obj().  Rework
handling of json_parser_parse_err() failing without setting an error.

Signed-off-by: Markus Armbruster <address@hidden>
---
 monitor.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/monitor.c b/monitor.c
index 493bed9..1e352a6 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3735,10 +3735,11 @@ static void handle_qmp_command(JSONMessageParser 
*parser, GQueue *tokens)
     Error *err = NULL;
 
     req = json_parser_parse_err(tokens, NULL, &err);
-    if (err || !req || qobject_type(req) != QTYPE_QDICT) {
-        if (!err) {
-            error_setg(&err, QERR_JSON_PARSING);
-        }
+    if (!req && !err) {
+        /* json_parser_parse_err() sucks: can fail without setting @err */
+        error_setg(&err, QERR_JSON_PARSING);
+    }
+    if (err) {
         goto err_out;
     }
 
-- 
2.7.4




reply via email to

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