From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBepg-0006Li-QN for qemu-devel@nongnu.org; Wed, 23 Dec 2015 03:31:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBepb-00039E-S3 for qemu-devel@nongnu.org; Wed, 23 Dec 2015 03:31:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBepb-00038m-Mp for qemu-devel@nongnu.org; Wed, 23 Dec 2015 03:31:35 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id B34BDC001269 for ; Wed, 23 Dec 2015 08:31:34 +0000 (UTC) Date: Wed, 23 Dec 2015 16:31:29 +0800 From: Fam Zheng Message-ID: <20151223083129.GJ14423@ad.usersys.redhat.com> References: <1450744268-25052-1-git-send-email-eblake@redhat.com> <1450744268-25052-7-git-send-email-eblake@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450744268-25052-7-git-send-email-eblake@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 06/14] qapi: Add qstring_append_format() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: pbonzini@redhat.com, Luiz Capitulino , qemu-devel@nongnu.org, armbru@redhat.com On Mon, 12/21 17:31, Eric Blake wrote: > Back in commit 764c1ca (Nov 2009), we added qstring_append_int(). > However, it did not see any use until commit 190c882 (Jan 2015). > Furthermore, it has a rather limited use case - to print anything > else, callers still have to format into a temporary buffer, unless > we want to introduce an explosion of new qstring_append_* methods > for each useful type to print. > > A much better approach is to add a wrapper that merges printf > behavior onto qstring_append, via the new qstring_append_format() > (and its vararg counterpart). In fact, with that in place, we > no longer need qstring_append_int(). > > Other immediate uses for the new function include simplifying > two existing clients of qstring_append() on a just-formatted > buffer, and the fact that we can take advantage of printf width > manipulations for more efficient indentation. > > Signed-off-by: Eric Blake Reviewed-by: Fam Zheng