From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAoSV-00019F-7x for qemu-devel@nongnu.org; Thu, 22 Mar 2012 16:18:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAoST-0000lM-BK for qemu-devel@nongnu.org; Thu, 22 Mar 2012 16:18:06 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:44719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAoST-0000lG-4b for qemu-devel@nongnu.org; Thu, 22 Mar 2012 16:18:05 -0400 Received: by pbcuo5 with SMTP id uo5so2215395pbc.4 for ; Thu, 22 Mar 2012 13:18:03 -0700 (PDT) Message-ID: <4F6B88F7.9080506@codemonkey.ws> Date: Thu, 22 Mar 2012 15:17:59 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1332417072-20329-1-git-send-email-pbonzini@redhat.com> <1332417072-20329-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1332417072-20329-5-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 04/10] qapi: shortcut visits on errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: lcapitulino@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org, Michael Roth On 03/22/2012 06:51 AM, Paolo Bonzini wrote: > We can exit very soon if we enter a visitor with a preexisting error. > This simplifies some cases because we will not have to deal with > obj being non-NULL while *obj is NULL. > > Signed-off-by: Paolo Bonzini Reviewed-by: Anthony Liguori Regards, Anthony Liguori > --- > scripts/qapi-visit.py | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py > index 54117d4..b242315 100644 > --- a/scripts/qapi-visit.py > +++ b/scripts/qapi-visit.py > @@ -61,6 +61,9 @@ def generate_visit_struct(name, members): > > void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **errp) > { > + if (error_is_set(errp)) { > + return; > + } > visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s), errp); > ''', > name=name) > @@ -81,6 +84,9 @@ void visit_type_%(name)sList(Visitor *m, %(name)sList ** obj, const char *name, > { > GenericList *i, **head = (GenericList **)obj; > > + if (error_is_set(errp)) { > + return; > + } > visit_start_list(m, name, errp); > > for (*head = i = visit_next_list(m, head, errp); i; i = visit_next_list(m,&i, errp)) { > @@ -112,6 +118,9 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error ** > { > Error *err = NULL; > > + if (error_is_set(errp)) { > + return; > + } > visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s),&err); > visit_type_%(name)sKind(m,&(*obj)->kind, "type",&err); > if (err) {