From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrIzm-0000hq-Nf for qemu-devel@nongnu.org; Thu, 12 Dec 2013 22:01:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrIzd-0005SA-89 for qemu-devel@nongnu.org; Thu, 12 Dec 2013 22:00:54 -0500 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:60512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrIzc-0005R4-JN for qemu-devel@nongnu.org; Thu, 12 Dec 2013 22:00:45 -0500 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 13 Dec 2013 08:30:41 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 821EAE0024 for ; Fri, 13 Dec 2013 08:33:00 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rBD30VjZ55443668 for ; Fri, 13 Dec 2013 08:30:31 +0530 Received: from d28av01.in.ibm.com (localhost [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rBD30beN019852 for ; Fri, 13 Dec 2013 08:30:38 +0530 Message-ID: <52AA7857.5000708@linux.vnet.ibm.com> Date: Fri, 13 Dec 2013 11:00:39 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1384307094-5836-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1384307094-5836-3-git-send-email-xiawenc@linux.vnet.ibm.com> <20131127194830.6715cc72@redhat.com> <5296EDB8.9040904@linux.vnet.ibm.com> <20131128093135.2ef9e21f@redhat.com> <529C2D21.80502@linux.vnet.ibm.com> In-Reply-To: <529C2D21.80502@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH RFC 2/3] qapi script: add support of event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: kwolf@redhat.com, pbonzini@redhat.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com 于 2013/12/2 14:48, Wenchao Xia 写道: > >>> >>>>> + >>>>> + if (!qapi_event_functions.emit) { >>>> >>>> Better to return an error here instead of silently failing. >>>> >>> >>> The purpose is allowing emit=NULL and skip event code in that case. >> >> But the code will do nothing and the caller won't know that. >> > Now the caller also won't know that useless code will be executed, > when qemu-img link with stub of monitor_event functions. :) > >> Actually, I wonder if the code should even abort() in such a case, >> as emit=NULL would be a programming today. >> > > I am not sure why the code should always do something. The code may > actually take CPU resource to do nothing meanful, such as build up a > qdict and release it later, when emit is not a valid function. So I > did this as an improvement: check emit function ahead to escape useless > work. > > Luiz, do you agree with me?