From: Wei Liu Date: Thu, 10 Apr 2014 15:18:00 +0000 (+0100) Subject: libxl/gentypes.py: generate empty map for None field in keyed-union X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5203 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5c77003b524af15a4a8a9d33ba0f2786f3a31c2b;p=xen.git libxl/gentypes.py: generate empty map for None field in keyed-union Without this the generated JSON is malformed. Signed-off-by: Wei Liu Acked-by: Ian Campbell --- diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 1a3b91cf68..917e2c2572 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):