[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V3 10/13] libxl/gentypes.py: include discriminator in JSON output
On Wed, Apr 23, 2014 at 11:40:24PM +0100, Andrew Cooper wrote: > On 23/04/2014 17:59, Wei Liu wrote: > > Parser relies on the discriminator to go to correct branch. > > > > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> > > --- > > tools/libxl/gentypes.py | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py > > index 61a2b3d..8d7183a 100644 > > --- a/tools/libxl/gentypes.py > > +++ b/tools/libxl/gentypes.py > > @@ -229,6 +229,11 @@ def libxl_C_type_gen_json(ty, v, indent = " ", > > parent = None): > > s += " goto out;\n" > > s += " break;\n" > > s += "}\n" > > + s += "s = yajl_gen_string(hand, (const unsigned char *)\"%s\", > > sizeof(\"%s\")-1);\n" \ > > + % (ty.keyvar.name, ty.keyvar.name) > > In python, all forms of string delimiter are equal, precisely to fix the > problem demonstrated here. This line can be made more legible using > single quotes for the main string, at which point the double quotes > around %s don't need escaping. > Oh, I just wanted to be consistent with the reset of the file. :-) Wei. > ~Andrew > > > + s += "if (s != yajl_gen_status_ok)\n" > > + s += " goto out;\n" > > + s += libxl_C_type_gen_json(ty.keyvar.type, (parent + > > ty.keyvar.name), indent, parent) > > elif isinstance(ty, idl.Struct) and (parent is None or ty.json_gen_fn > > is None): > > s += "s = yajl_gen_map_open(hand);\n" > > s += "if (s != yajl_gen_status_ok)\n" _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |