From nobody Tue Nov 4 21:46:12 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153087498006823.0810057846669; Fri, 6 Jul 2018 04:03:00 -0700 (PDT) Received: from localhost ([::1]:57012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbOVv-0003K2-A6 for importer@patchew.org; Fri, 06 Jul 2018 07:02:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbOR7-00082D-TA for qemu-devel@nongnu.org; Fri, 06 Jul 2018 06:58:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbOR7-0006zs-1T for qemu-devel@nongnu.org; Fri, 06 Jul 2018 06:58:01 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53610 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fbOR6-0006xc-KZ for qemu-devel@nongnu.org; Fri, 06 Jul 2018 06:58:00 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23CA2401DE6F for ; Fri, 6 Jul 2018 10:58:00 +0000 (UTC) Received: from localhost (ovpn-112-48.ams2.redhat.com [10.36.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66078111DCFC; Fri, 6 Jul 2018 10:57:57 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 6 Jul 2018 12:57:28 +0200 Message-Id: <20180706105753.26700-3-marcandre.lureau@redhat.com> In-Reply-To: <20180706105753.26700-1-marcandre.lureau@redhat.com> References: <20180706105753.26700-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 06 Jul 2018 10:58:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 06 Jul 2018 10:58:00 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v6 02/27] json: remove useless return value from lexer/parser X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The lexer always returns 0 when char feeding. Furthermore, none of the caller care about the return value. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20180326150916.9602-10-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster Reviewed-by: Thomas Huth --- include/qapi/qmp/json-lexer.h | 4 ++-- include/qapi/qmp/json-streamer.h | 4 ++-- qobject/json-lexer.c | 23 ++++++++--------------- qobject/json-streamer.c | 8 ++++---- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/include/qapi/qmp/json-lexer.h b/include/qapi/qmp/json-lexer.h index afee7828cd..66ccf0357c 100644 --- a/include/qapi/qmp/json-lexer.h +++ b/include/qapi/qmp/json-lexer.h @@ -47,9 +47,9 @@ struct JSONLexer =20 void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func); =20 -int json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size); +void json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size); =20 -int json_lexer_flush(JSONLexer *lexer); +void json_lexer_flush(JSONLexer *lexer); =20 void json_lexer_destroy(JSONLexer *lexer); =20 diff --git a/include/qapi/qmp/json-streamer.h b/include/qapi/qmp/json-strea= mer.h index 00d8a23af8..cb808cf27d 100644 --- a/include/qapi/qmp/json-streamer.h +++ b/include/qapi/qmp/json-streamer.h @@ -36,10 +36,10 @@ typedef struct JSONMessageParser void json_message_parser_init(JSONMessageParser *parser, void (*func)(JSONMessageParser *, GQueue *)); =20 -int json_message_parser_feed(JSONMessageParser *parser, +void json_message_parser_feed(JSONMessageParser *parser, const char *buffer, size_t size); =20 -int json_message_parser_flush(JSONMessageParser *parser); +void json_message_parser_flush(JSONMessageParser *parser); =20 void json_message_parser_destroy(JSONMessageParser *parser); =20 diff --git a/qobject/json-lexer.c b/qobject/json-lexer.c index 980ba159d6..df9b674322 100644 --- a/qobject/json-lexer.c +++ b/qobject/json-lexer.c @@ -290,7 +290,7 @@ void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter= func) lexer->x =3D lexer->y =3D 0; } =20 -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; =20 @@ -344,7 +344,7 @@ static int json_lexer_feed_char(JSONLexer *lexer, char = ch, bool flush) g_string_truncate(lexer->token, 0); new_state =3D IN_START; lexer->state =3D new_state; - return 0; + return; default: break; } @@ -359,29 +359,22 @@ static int json_lexer_feed_char(JSONLexer *lexer, cha= r ch, bool flush) g_string_truncate(lexer->token, 0); lexer->state =3D IN_START; } - - return 0; } =20 -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; =20 for (i =3D 0; i < size; i++) { - int err; - - err =3D json_lexer_feed_char(lexer, buffer[i], false); - if (err < 0) { - return err; - } + json_lexer_feed_char(lexer, buffer[i], false); } - - return 0; } =20 -int json_lexer_flush(JSONLexer *lexer) +void json_lexer_flush(JSONLexer *lexer) { - return lexer->state =3D=3D IN_START ? 0 : json_lexer_feed_char(lexer, = 0, true); + if (lexer->state !=3D IN_START) { + json_lexer_feed_char(lexer, 0, true); + } } =20 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 *pars= er, json_lexer_init(&parser->lexer, json_message_process_token); } =20 -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); } =20 -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); } =20 void json_message_parser_destroy(JSONMessageParser *parser) --=20 2.18.0.rc1