From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQB70-0007YL-Db for qemu-devel@nongnu.org; Thu, 11 Apr 2013 02:35:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQB6z-0000nP-21 for qemu-devel@nongnu.org; Thu, 11 Apr 2013 02:35:57 -0400 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:59443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQB6x-0000n8-Sq for qemu-devel@nongnu.org; Thu, 11 Apr 2013 02:35:56 -0400 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 11 Apr 2013 12:02:38 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 0A1CB3940023 for ; Thu, 11 Apr 2013 12:05:50 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3B6ZhV84325698 for ; Thu, 11 Apr 2013 12:05:43 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3B6Zn0f017712 for ; Thu, 11 Apr 2013 16:35:49 +1000 Message-ID: <516659A9.3010101@linux.vnet.ibm.com> Date: Thu, 11 Apr 2013 14:35:21 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1364903250-10429-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1364903250-10429-14-git-send-email-xiawenc@linux.vnet.ibm.com> <87fvyytixe.fsf@blackfin.pond.sub.org> In-Reply-To: <87fvyytixe.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V11 13/17] block: dump to buffer for bdrv_snapshot_dump() and bdrv_image_info_dump() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, stefanha@gmail.com, pbonzini@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com >> >> -void bdrv_image_info_dump(ImageInfo *info) >> +void bdrv_image_info_dump(GString *buf, ImageInfo *info) >> { >> char size_buf[128], dsize_buf[128]; >> if (!info->has_actual_size) { >> @@ -370,43 +369,48 @@ void bdrv_image_info_dump(ImageInfo *info) > > I don't like this change, because it introduces buffering for no > discernible reason. Unless you can show me one, I'd like you to keep > printing directly. > HMP code later need to call this function, and then print buf to monitor console, which is the goal of this patch. >> info->actual_size); >> } >> >> static gboolean str_equal_func(gconstpointer a, gconstpointer b) >> diff --git a/savevm.c b/savevm.c >> index e4e0008..ce0bbe1 100644 >> --- a/savevm.c >> +++ b/savevm.c >> @@ -2466,7 +2466,7 @@ void do_info_snapshots(Monitor *mon, const QDict *qdict) >> int nb_sns, i, ret, available; >> int total; >> int *available_snapshots; >> - char buf[256]; >> + GString *buf = NULL; > > Useless initialization. But if you keep bdrv_snapshot_dump() printing, > it all goes away. > will remove. -- Best Regards Wenchao Xia