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

Re: [Xen-devel] [PATCH 2/6] libxl_json: Introduce libxl__json_object_to_yajl_gen.

Anthony PERARD writes ("[PATCH 2/6] libxl_json: Introduce 
> This function converts a libxl__json_object to yajl by calling every
> yajl_gen_* function on a preallocated yajl_gen hand.

I'm slightly concerned at the amount of boilerplateish code we're
introducing here.  Forgive my utter ignorance but is there not some
more automatic way of handling all this ?

At least it looks reasonably generic so if there is no better way to
do it then fine.

I have some more detailed comments:

> +yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
> +                                           yajl_gen hand,
> +                                           libxl__json_object *obj)
> +{
> +    int index = 0;
> +    yajl_status rc;
> +
> +    if (obj == NULL)
> +        return -1;

Is this an expected situation ?  Surely we should crash if we pass
NULL rather than silently inventing an error code ?

> +    default:
> +        return -1;

When might this occur ?


Xen-devel mailing list



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