diff options
author | Markus Armbruster <armbru@redhat.com> | 2018-08-23 18:40:16 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2018-08-24 20:26:37 +0200 |
commit | 8d3265b3d00db1071d1d3bf8433b4818088fdeb5 (patch) | |
tree | b34bdf95732887c44ec36fba4e60a746e1552e3c | |
parent | da09cfbf9dcd07c48fe95bdfb2968305de9b9690 (diff) |
json: Streamline json_message_process_token()
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180823164025.12553-50-armbru@redhat.com>
-rw-r--r-- | qobject/json-streamer.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/qobject/json-streamer.c b/qobject/json-streamer.c index 810aae521f..954bf9d468 100644 --- a/qobject/json-streamer.c +++ b/qobject/json-streamer.c @@ -99,16 +99,13 @@ void json_message_process_token(JSONLexer *lexer, GString *input, g_queue_push_tail(parser->tokens, token); - if (parser->brace_count < 0 || - parser->bracket_count < 0 || - (parser->brace_count == 0 && - parser->bracket_count == 0)) { - json = json_parser_parse(parser->tokens, parser->ap, &err); - parser->tokens = NULL; - goto out_emit; + if ((parser->brace_count > 0 || parser->bracket_count > 0) + && parser->bracket_count >= 0 && parser->bracket_count >= 0) { + return; } - return; + json = json_parser_parse(parser->tokens, parser->ap, &err); + parser->tokens = NULL; out_emit: parser->brace_count = 0; |