WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH V2 02/11] libxl_json, Check the parser status bef

To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH V2 02/11] libxl_json, Check the parser status before to call parse_complete
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Tue, 25 Oct 2011 18:27:38 +0100
Cc: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Tue, 25 Oct 2011 10:49:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1319133573-25891-3-git-send-email-anthony.perard@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Newsgroups: chiark.mail.xen.devel
References: <1319133573-25891-1-git-send-email-anthony.perard@xxxxxxxxxx> <1319133573-25891-3-git-send-email-anthony.perard@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Anthony PERARD writes ("[Xen-devel] [PATCH V2 02/11] libxl_json, Check the 
parse> -    status = yajl_parse_complete(yajl_ctx.hand);
> +    if (status == yajl_status_ok) {
> +        status = yajl_parse_complete(yajl_ctx.hand);
> +    }

Perhaps this would be better done with the "goto out" pattern ?

Ie:

    status = yajl_do_something();
    if (status != yajl_status_ok) goto out;

    status = ....

    ....

    return o;

  out:
    blah blah get_error blah blah
    return NULL;

That would make the logic clearer I think.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>