diff mbox

[Xen-devel,33/34] tools/libxl: libxl__json_object_to_yajl_gen should return yajl_gen_status

Message ID 1395766541-23979-34-git-send-email-julien.grall@linaro.org
State Deferred, archived
Headers show

Commit Message

Julien Grall March 25, 2014, 4:55 p.m. UTC
All the functions in lixbl__json_object_to_yajl_gen returns an yajl_gen_status
enum.

Also replace yal_gen_status_ok by yalj_gen_status_ok.

This is fix compilation with clang 3.5:
libxl_json.c:378:16: error: implicit conversion from enumeration type 'yajl_gen_status' to different enumeration type 'yajl_status' [-Werror,-Wenum-conversion]
        return yajl_gen_null(hand);
        ~~~~~~ ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
 tools/libxl/libxl_internal.h |    2 +-
 tools/libxl/libxl_json.c     |   18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

Comments

Ian Campbell March 25, 2014, 5:28 p.m. UTC | #1
On Tue, 2014-03-25 at 16:55 +0000, Julien Grall wrote:
> All the functions in lixbl__json_object_to_yajl_gen returns an yajl_gen_status
> enum.
> 
> Also replace yal_gen_status_ok by yalj_gen_status_ok.

Does this work with both yajl1 and yajl2? We are trying to support both.

Ian.
Julien Grall March 27, 2014, 12:37 p.m. UTC | #2
Hi Ian,

On 03/25/2014 05:28 PM, Ian Campbell wrote:
> On Tue, 2014-03-25 at 16:55 +0000, Julien Grall wrote:
>> All the functions in lixbl__json_object_to_yajl_gen returns an yajl_gen_status
>> enum.
>>
>> Also replace yal_gen_status_ok by yalj_gen_status_ok.
> 
> Does this work with both yajl1 and yajl2? We are trying to support both.

I checked yajl 1.0.12 API, as yajl2 every yajl_gen_* functions return an
yajl_gen_status.

Every other functions in libxl_json.c was correctly using yajl_gen_status.

Regards,
Ian Campbell March 27, 2014, 5:16 p.m. UTC | #3
On Thu, 2014-03-27 at 12:37 +0000, Julien Grall wrote:
> Hi Ian,
> 
> On 03/25/2014 05:28 PM, Ian Campbell wrote:
> > On Tue, 2014-03-25 at 16:55 +0000, Julien Grall wrote:
> >> All the functions in lixbl__json_object_to_yajl_gen returns an yajl_gen_status
> >> enum.
> >>
> >> Also replace yal_gen_status_ok by yalj_gen_status_ok.
> > 
> > Does this work with both yajl1 and yajl2? We are trying to support both.
> 
> I checked yajl 1.0.12 API, as yajl2 every yajl_gen_* functions return an
> yajl_gen_status.
> 
> Every other functions in libxl_json.c was correctly using yajl_gen_status.

Thanks. Acked-by: Ian Campbell <ian.campbell@citrix.com>

Ian.
diff mbox

Patch

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index b3a200d..bfefd31 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1722,7 +1722,7 @@  libxl__json_map_node *libxl__json_map_node_get(const libxl__json_object *o,
 _hidden const libxl__json_object *libxl__json_map_get(const char *key,
                                           const libxl__json_object *o,
                                           libxl__json_node_type expected_type);
-_hidden yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc_opt,
+_hidden yajl_gen_status libxl__json_object_to_yajl_gen(libxl__gc *gc_opt,
                                                    yajl_gen hand,
                                                    libxl__json_object *param);
 _hidden void libxl__json_object_free(libxl__gc *gc_opt,
diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
index d2f7de8..8e28c58 100644
--- a/tools/libxl/libxl_json.c
+++ b/tools/libxl/libxl_json.c
@@ -366,12 +366,12 @@  const libxl__json_object *libxl__json_map_get(const char *key,
     return NULL;
 }
 
-yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
-                                           yajl_gen hand,
-                                           libxl__json_object *obj)
+yajl_gen_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
+                                               yajl_gen hand,
+                                               libxl__json_object *obj)
 {
     int idx = 0;
-    yajl_status rc;
+    yajl_gen_status rc;
 
     switch (obj->type) {
     case JSON_NULL:
@@ -390,17 +390,17 @@  yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
         libxl__json_map_node *node = NULL;
 
         rc = yajl_gen_map_open(hand);
-        if (rc != yajl_status_ok)
+        if (rc != yajl_gen_status_ok)
             return rc;
         for (idx = 0; idx < obj->u.map->count; idx++) {
             if (flexarray_get(obj->u.map, idx, (void**)&node) != 0)
                 break;
 
             rc = libxl__yajl_gen_asciiz(hand, node->map_key);
-            if (rc != yajl_status_ok)
+            if (rc != yajl_gen_status_ok)
                 return rc;
             rc = libxl__json_object_to_yajl_gen(gc, hand, node->obj);
-            if (rc != yajl_status_ok)
+            if (rc != yajl_gen_status_ok)
                 return rc;
         }
         return yajl_gen_map_close(hand);
@@ -409,13 +409,13 @@  yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
         libxl__json_object *node = NULL;
 
         rc = yajl_gen_array_open(hand);
-        if (rc != yajl_status_ok)
+        if (rc != yajl_gen_status_ok)
             return rc;
         for (idx = 0; idx < obj->u.array->count; idx++) {
             if (flexarray_get(obj->u.array, idx, (void**)&node) != 0)
                 break;
             rc = libxl__json_object_to_yajl_gen(gc, hand, node);
-            if (rc != yajl_status_ok)
+            if (rc != yajl_gen_status_ok)
                 return rc;
         }
         return yajl_gen_array_close(hand);