From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw8Qu-0002pw-UV for qemu-devel@nongnu.org; Fri, 29 Apr 2016 09:26:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aw8Qj-0000rr-9C for qemu-devel@nongnu.org; Fri, 29 Apr 2016 09:26:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw8Qj-0000pO-4T for qemu-devel@nongnu.org; Fri, 29 Apr 2016 09:26:01 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 146A362661 for ; Fri, 29 Apr 2016 13:25:50 +0000 (UTC) From: Markus Armbruster References: <1461903820-3092-1-git-send-email-eblake@redhat.com> <1461903820-3092-6-git-send-email-eblake@redhat.com> Date: Fri, 29 Apr 2016 15:25:47 +0200 In-Reply-To: <1461903820-3092-6-git-send-email-eblake@redhat.com> (Eric Blake's message of "Thu, 28 Apr 2016 22:23:26 -0600") Message-ID: <87eg9oy2as.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 05/18] qapi: Use qstring_append_chr() where appropriate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, famz@redhat.com, Luiz Capitulino Eric Blake writes: > No need to create a temporary buffer, when we already have a > function available for our needs. > > Signed-off-by: Eric Blake > Reviewed-by: Fam Zheng > > --- > v3: no change > v2: no change > --- > qobject/json-parser.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/qobject/json-parser.c b/qobject/json-parser.c > index c18e48a..5fbaf58 100644 > --- a/qobject/json-parser.c > +++ b/qobject/json-parser.c > @@ -204,12 +204,7 @@ static QString *qstring_from_escaped_str(JSONParserContext *ctxt, > goto out; > } > } else { > - char dummy[2]; > - > - dummy[0] = *ptr++; > - dummy[1] = 0; > - > - qstring_append(str, dummy); > + qstring_append_chr(str, *ptr++); > } > } The function has several qstring_append(str, S) where S consists of a single character. They could all be converted to qstring_append_chr().