mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13: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
|
@ -32,20 +32,13 @@ typedef enum json_token_type {
|
|||
JSON_ERROR,
|
||||
} JSONTokenType;
|
||||
|
||||
typedef struct JSONLexer JSONLexer;
|
||||
|
||||
typedef void (JSONLexerEmitter)(JSONLexer *, GString *,
|
||||
JSONTokenType, int x, int y);
|
||||
|
||||
struct JSONLexer
|
||||
{
|
||||
JSONLexerEmitter *emit;
|
||||
typedef struct JSONLexer {
|
||||
int state;
|
||||
GString *token;
|
||||
int x, y;
|
||||
};
|
||||
} JSONLexer;
|
||||
|
||||
void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func);
|
||||
void json_lexer_init(JSONLexer *lexer);
|
||||
|
||||
void json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue