[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V5 20/32] libxl IDL: generate code to parse libxl__json_object to libxl_FOO struct



On Tue, May 20, 2014 at 02:35:02PM +0100, Ian Campbell wrote:
> On Tue, 2014-05-13 at 22:54 +0100, Wei Liu wrote:
> > libxl_FOO_parse_json functions are generated.
> > 
> > Note that these functions are used to parse libxl__json_object to
> > libxl__FOO struct. They don't consume JSON string.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> 
> I eyeballed this again and the only query I have is this:
> 
> +    if (libxl__json_map_get("enable", o, JSON_STRING)) {
> +        x = libxl__json_map_get("enable", o, JSON_STRING);
> 
> These two get calls are a bit redundant.
> 
> Looking at the code generator I don't think it forces this on you and
> you could arrange instead for:
>     x = libxl__json_map_get("enable", o, JSON_STRING);
>     if (x) {
>         ...
> 
> Perhaps you need to save x in a new local parent so you can restore it
> in that case.
>     saved_parent = x;
>     x = libxl__json_map_get("enable", o, JSON_STRING);
>     if (x) {
>         ...
>     }
>     x = saved_parent;
> 

Done.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.