[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union
On Mon, Apr 14, 2014 at 05:53:11PM +0100, Ian Campbell wrote: > On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote: > > Without this the generated JSON is malformed. > > > > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> > > Hold on the Ack... > > > + else: > > + s += " yajl_gen_map_open(hand);\n" > > ITHM s =... > > > + s += " if (s != yajl_gen_status_ok)\n" > > + s += " goto out;\n" > > + s += " yajl_gen_map_close(hand);\n" > > and again. > > Spotted because the diff of the generated code across the entire series > was as below, the spurious change is pretty obvious in the third hunk. > I should've stolen your handy script earlier! This one should be correct. ---8<--- From eda04499a0b15d0a7549206834112823b59cf6f9 Mon Sep 17 00:00:00 2001 From: Wei Liu <wei.liu2@xxxxxxxxxx> Date: Thu, 10 Apr 2014 16:18:00 +0100 Subject: [PATCH] libxl/gentypes.py: generate empty map for None field in keyed-union Without this the generated JSON is malformed. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxl/gentypes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 1a3b91c..917e2c2 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -220,6 +220,13 @@ def libxl_C_type_gen_json(ty, v, indent = " ", parent = None): s += "case %s:\n" % f.enumname if f.type is not None: s += libxl_C_type_gen_json(f.type, fexpr, indent + " ", nparent) + else: + s += " s = yajl_gen_map_open(hand);\n" + s += " if (s != yajl_gen_status_ok)\n" + s += " goto out;\n" + s += " s = yajl_gen_map_close(hand);\n" + s += " if (s != yajl_gen_status_ok)\n" + s += " goto out;\n" s += " break;\n" s += "}\n" elif isinstance(ty, idl.Struct) and (parent is None or ty.json_fn is None): -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |