summaryrefslogtreecommitdiffstats
path: root/qobject
diff options
context:
space:
mode:
authorMarc-André Lureau2018-08-23 18:39:58 +0200
committerMarkus Armbruster2018-08-24 20:26:37 +0200
commit7c1e1d5481fe8d2e757469179f9ccd14e8838ed1 (patch)
treec0ccabd792d82e364a9646f19b0336773333742b /qobject
parentcheck-qjson: Fix and enable utf8_string()'s disabled part (diff)
downloadqemu-7c1e1d5481fe8d2e757469179f9ccd14e8838ed1.tar.gz
qemu-7c1e1d5481fe8d2e757469179f9ccd14e8838ed1.tar.xz
qemu-7c1e1d5481fe8d2e757469179f9ccd14e8838ed1.zip
json: remove useless return value from lexer/parser
The lexer always returns 0 when char feeding. Furthermore, none of the caller care about the return value. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180326150916.9602-10-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180823164025.12553-32-armbru@redhat.com>
Diffstat (limited to 'qobject')
-rw-r--r--qobject/json-lexer.c23
-rw-r--r--qobject/json-streamer.c8
2 files changed, 12 insertions, 19 deletions
diff --git a/qobject/json-lexer.c b/qobject/json-lexer.c
index 0731779470..d9701f857b 100644
--- a/qobject/json-lexer.c
+++ b/qobject/json-lexer.c
@@ -286,7 +286,7 @@ void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func)
lexer->x = lexer->y = 0;
}
-static int json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush)
+static void json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush)
{
int char_consumed, new_state;
@@ -340,7 +340,7 @@ static int json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush)
g_string_truncate(lexer->token, 0);
new_state = IN_START;
lexer->state = new_state;
- return 0;
+ return;
default:
break;
}
@@ -355,29 +355,22 @@ static int json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush)
g_string_truncate(lexer->token, 0);
lexer->state = IN_START;
}
-
- return 0;
}
-int json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size)
+void json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size)
{
size_t i;
for (i = 0; i < size; i++) {
- int err;
-
- err = json_lexer_feed_char(lexer, buffer[i], false);
- if (err < 0) {
- return err;
- }
+ json_lexer_feed_char(lexer, buffer[i], false);
}
-
- return 0;
}
-int json_lexer_flush(JSONLexer *lexer)
+void json_lexer_flush(JSONLexer *lexer)
{
- return lexer->state == IN_START ? 0 : json_lexer_feed_char(lexer, 0, true);
+ if (lexer->state != IN_START) {
+ json_lexer_feed_char(lexer, 0, true);
+ }
}
void json_lexer_destroy(JSONLexer *lexer)
diff --git a/qobject/json-streamer.c b/qobject/json-streamer.c
index c51c2021f9..78dfff2aa0 100644
--- a/qobject/json-streamer.c
+++ b/qobject/json-streamer.c
@@ -118,15 +118,15 @@ void json_message_parser_init(JSONMessageParser *parser,
json_lexer_init(&parser->lexer, json_message_process_token);
}
-int json_message_parser_feed(JSONMessageParser *parser,
+void json_message_parser_feed(JSONMessageParser *parser,
const char *buffer, size_t size)
{
- return json_lexer_feed(&parser->lexer, buffer, size);
+ json_lexer_feed(&parser->lexer, buffer, size);
}
-int json_message_parser_flush(JSONMessageParser *parser)
+void json_message_parser_flush(JSONMessageParser *parser)
{
- return json_lexer_flush(&parser->lexer);
+ json_lexer_flush(&parser->lexer);
}
void json_message_parser_destroy(JSONMessageParser *parser)