From: Ian Campbell Subject: Re: [PATCH V2 3/4] libxl/gentypes.py: generate empty map for None field in keyed-union Date: Mon, 14 Apr 2014 17:53:11 +0100 Message-ID: <1397494391.7802.20.camel@dagon.hellion.org.uk> References: <1397143594-15308-1-git-send-email-wei.liu2@citrix.com> <1397143594-15308-4-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-4-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: Wei Liu Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 2014-04-10 at 16:26 +0100, Wei Liu wrote: > Without this the generated JSON is malformed. > > Signed-off-by: Wei Liu 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. Ian. --- tools/libxl/_libxl_BACKUP_types.c 2014-04-14 17:51:03.000000000 +0100 +++ tools/libxl/_libxl_types.c 2014-04-14 17:51:11.000000000 +0100 @@ -2523,6 +2523,12 @@ yajl_gen_status libxl_domain_build_info_ goto out; break; case LIBXL_DOMAIN_TYPE_INVALID: + yajl_gen_map_open(hand); + if (s != yajl_gen_status_ok) + goto out; + yajl_gen_map_close(hand); + if (s != yajl_gen_status_ok) + goto out; break; } s = yajl_gen_map_close(hand); @@ -3631,9 +3637,6 @@ yajl_gen_status libxl_event_gen_json(yaj s = yajl_gen_map_open(hand); if (s != yajl_gen_status_ok) goto out; - s = yajl_gen_string(hand, (const unsigned char *)"link", sizeof("link")-1); - if (s != yajl_gen_status_ok) - goto out; s = yajl_gen_string(hand, (const unsigned char *)"domid", sizeof("domid")-1); if (s != yajl_gen_status_ok) goto out; @@ -3713,10 +3716,10 @@ yajl_gen_status libxl_event_gen_json(yaj goto out; break; case LIBXL_EVENT_TYPE_DOMAIN_CREATE_CONSOLE_AVAILABLE: - s = yajl_gen_map_open(hand); + yajl_gen_map_open(hand); if (s != yajl_gen_status_ok) goto out; - s = yajl_gen_map_close(hand); + yajl_gen_map_close(hand); if (s != yajl_gen_status_ok) goto out; break; --- tools/libxl/_libxl_BACKUP_types.h 2014-04-14 17:51:03.000000000 +0100 +++ tools/libxl/_libxl_types.h 2014-04-14 17:51:11.000000000 +0100 @@ -694,8 +694,6 @@ typedef struct libxl_event { struct { int rc; } operation_complete; - struct { - } domain_create_console_available; } u; } libxl_event; void libxl_event_dispose(libxl_event *p);