From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVCJe-0000k6-9R for qemu-devel@nongnu.org; Wed, 24 Apr 2013 22:53:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVCJd-0005gR-2o for qemu-devel@nongnu.org; Wed, 24 Apr 2013 22:53:46 -0400 Received: from e23smtp04.au.ibm.com ([202.81.31.146]:44133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVCJb-0005g6-U3 for qemu-devel@nongnu.org; Wed, 24 Apr 2013 22:53:45 -0400 Received: from /spool/local by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Apr 2013 12:41:46 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 0A41B2BB0051 for ; Thu, 25 Apr 2013 12:53:37 +1000 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3P2dqFq7471436 for ; Thu, 25 Apr 2013 12:39:52 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3P2ramX026488 for ; Thu, 25 Apr 2013 12:53:36 +1000 Message-ID: <51789A9D.80905@linux.vnet.ibm.com> Date: Thu, 25 Apr 2013 10:53:17 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <51780BD3.6000004@redhat.com> In-Reply-To: <51780BD3.6000004@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2 01/12] qemu-img: introduce qemu_img_handle_error() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, armbru@redhat.com, Pavel Hrdina , qemu-devel@nongnu.org, lcapitulino@redhat.com 于 2013-4-25 0:44, Eric Blake 写道: > On 04/24/2013 09:31 AM, Pavel Hrdina wrote: >> Later in the patch series we will use this function a few times. >> This will avoid duplicating the code. >> >> Signed-off-by: Pavel Hrdina >> --- >> qemu-img.c | 17 +++++++++++------ >> 1 file changed, 11 insertions(+), 6 deletions(-) > > >> >> +static int qemu_img_handle_error(Error *err) >> +{ >> + if (error_is_set(&err)) { >> + error_report("%s", error_get_pretty(err)); >> + error_free(err); >> + return 1; >> + } >> + return 0; > > Maybe it's just me, but I think returning EXIT_SUCCESS/EXIT_FAILURE > instead of 0/1 is a bit nicer at expressing why we chose a positive > value; but that would be a separate cleanup to all of qemu-img.c. > Hence, I have no problems giving: > > Reviewed-by: Eric Blake > Maybe an incode comments like: +/* Returns 1 on error. */ Reviewed-by: Wenchao Xia -- Best Regards Wenchao Xia