mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
json: Have lexer call streamer directly
json_lexer_init() takes the function to process a token as an argument. It's always json_message_process_token(). Makes the code harder to understand for no actual gain. Drop the indirection. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180823164025.12553-34-armbru@redhat.com>
This commit is contained in:
parent
e8b19d7d73
commit
037f244088
4 changed files with 17 additions and 18 deletions
|
@ -34,8 +34,8 @@ static void json_message_free_tokens(JSONMessageParser *parser)
|
|||
}
|
||||
}
|
||||
|
||||
static void json_message_process_token(JSONLexer *lexer, GString *input,
|
||||
JSONTokenType type, int x, int y)
|
||||
void json_message_process_token(JSONLexer *lexer, GString *input,
|
||||
JSONTokenType type, int x, int y)
|
||||
{
|
||||
JSONMessageParser *parser = container_of(lexer, JSONMessageParser, lexer);
|
||||
JSONToken *token;
|
||||
|
@ -115,7 +115,7 @@ void json_message_parser_init(JSONMessageParser *parser,
|
|||
parser->tokens = g_queue_new();
|
||||
parser->token_size = 0;
|
||||
|
||||
json_lexer_init(&parser->lexer, json_message_process_token);
|
||||
json_lexer_init(&parser->lexer);
|
||||
}
|
||||
|
||||
void json_message_parser_feed(JSONMessageParser *parser,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue