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>
This commit is contained in:
Markus Armbruster 2018-08-23 18:40:16 +02:00
parent da09cfbf9d
commit 8d3265b3d0

View File

@ -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;