]> git.proxmox.com Git - mirror_qemu.git/commitdiff
json: Don't create JSON_ERROR tokens that won't be used
authorMarkus Armbruster <armbru@redhat.com>
Thu, 23 Aug 2018 16:40:03 +0000 (18:40 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 24 Aug 2018 18:26:37 +0000 (20:26 +0200)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180823164025.12553-37-armbru@redhat.com>

qobject/json-streamer.c

index 0c33186e8e2a99a40c5275c499a7ff094c926c2c..fa595a876151622d36fb5141ada31fc77e150fb6 100644 (file)
@@ -56,6 +56,8 @@ void json_message_process_token(JSONLexer *lexer, GString *input,
     case JSON_RSQUARE:
         parser->bracket_count--;
         break;
+    case JSON_ERROR:
+        goto out_emit;
     default:
         break;
     }
@@ -71,10 +73,6 @@ void json_message_process_token(JSONLexer *lexer, GString *input,
 
     g_queue_push_tail(parser->tokens, token);
 
-    if (type == JSON_ERROR) {
-        goto out_emit;
-    }
-
     if (parser->brace_count < 0 ||
         parser->bracket_count < 0 ||
         (parser->brace_count == 0 &&