From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union Date: Thu, 10 Apr 2014 16:26:33 +0100 Message-ID: <1397143594-15308-4-git-send-email-wei.liu2@citrix.com> References: <1397143594-15308-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1397143594-15308-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Wei Liu , ian.jackson@eu.citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org Without this the generated JSON is malformed. Signed-off-by: Wei Liu --- tools/libxl/gentypes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 1a3b91c..bfb95e2 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 += " yajl_gen_map_open(hand);\n" + s += " if (s != yajl_gen_status_ok)\n" + s += " goto out;\n" + 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