[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 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.

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);



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.