Received: from eggs.gnu.org ([2001:4830:134:3::10]:60725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1rtR-0002WX-3k for qemu-devel@nongnu.org; Thu, 26 Nov 2015 03:27:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1rtN-0007Fh-Ti for qemu-devel@nongnu.org; Thu, 26 Nov 2015 03:27:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1rtN-0007Fc-OP for qemu-devel@nongnu.org; Thu, 26 Nov 2015 03:27:01 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 33AC5A3D2A for ; Thu, 26 Nov 2015 08:27:01 +0000 (UTC) From: Markus Armbruster References: <1448486613-17634-1-git-send-email-armbru@redhat.com> <1448486613-17634-7-git-send-email-armbru@redhat.com> <565631AA.2090301@redhat.com> Date: Thu, 26 Nov 2015 09:26:58 +0100 In-Reply-To: <565631AA.2090301@redhat.com> (Eric Blake's message of "Wed, 25 Nov 2015 15:09:46 -0700") Message-ID: <87d1uxmai5.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 for-2.5 06/12] qjson: Inline token_is_keyword() and simplify List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com Eric Blake writes: > On 11/25/2015 02:23 PM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster >> --- >> qobject/json-parser.c | 20 +++++++------------- >> 1 file changed, 7 insertions(+), 13 deletions(-) >> > >> >> - if (token_is_keyword(token, "true")) { >> + val = token_get_value(token); >> + >> + if (!strcmp(val, "true")) { >> ret = QOBJECT(qbool_from_bool(true)); >> - } else if (token_is_keyword(token, "false")) { >> + } else if (!strcmp(val, "false")) { >> ret = QOBJECT(qbool_from_bool(false)); >> - } else if (token_is_keyword(token, "null")) { >> + } else if (!strcmp(val, "null")) { >> ret = qnull(); >> } else { >> - parse_error(ctxt, token, "invalid keyword `%s'", token_get_value(token)); >> + parse_error(ctxt, token, "invalid keyword '%s'", val); > > Yay - fewer `' in error messages. (Great back in the day when fonts > rendered them symmetrically, and still useful in m4; but lousy for > pasting into shell code and in modern fonts) Perhaps we can some day use the proper U+2018 (LEFT SINGLE QUOTATION MARK) and U+2019 (RIGHT SINGLE QUOTATION MARK). > Reviewed-by: Eric Blake Thanks!