[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] libxl: Add comments to libxl__json_*get* functions



commit 3729730e94c4e7909a80320e7e0e195b9663d584
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Thu Jan 3 18:24:56 2019 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Jan 11 14:57:52 2019 +0000

    libxl: Add comments to libxl__json_*get* functions
    
    This comments that libxl__json_object_get_* and libxl__json_*_get
    functions accept the libxl__json_object parameter to be NULL.
    
    libxl__json_object_to_json also works with NULL.
    
    This also move libxl__json_object_alloc declaration closer to similar
    functions, and closer to libxl__json_object_free.
    
    Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_internal.h | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index bf3b85b013..459f9bffa8 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2104,6 +2104,10 @@ static inline bool libxl__json_object_is_array(const 
libxl__json_object *o)
     return o != NULL && o->type == JSON_ARRAY;
 }
 
+/*
+ * `o` may be NULL for all libxl__json_object_get_* functions.
+ */
+
 static inline bool libxl__json_object_get_bool(const libxl__json_object *o)
 {
     if (libxl__json_object_is_bool(o))
@@ -2152,11 +2156,9 @@ static inline long long 
libxl__json_object_get_integer(const libxl__json_object
 }
 
 /*
- * NOGC can be used with those json_object functions, but the
- * libxl__json_object* will need to be freed with libxl__json_object_free.
+ * `o` may be NULL for the following libxl__json_*_get functions.
  */
-_hidden libxl__json_object *libxl__json_object_alloc(libxl__gc *gc_opt,
-                                                     libxl__json_node_type 
type);
+
 _hidden libxl__json_object *libxl__json_array_get(const libxl__json_object *o,
                                                   int i);
 _hidden
@@ -2165,6 +2167,13 @@ 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);
+
+/*
+ * NOGC can be used with those json_object functions, but the
+ * libxl__json_object* will need to be freed with libxl__json_object_free.
+ */
+_hidden libxl__json_object *libxl__json_object_alloc(libxl__gc *gc_opt,
+                                                     libxl__json_node_type 
type);
 _hidden yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc_opt,
                                                    yajl_gen hand,
                                                    const libxl__json_object 
*param);
@@ -2173,6 +2182,7 @@ _hidden void libxl__json_object_free(libxl__gc *gc_opt,
 
 _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char 
*s);
 
+/* `args` may be NULL */
 _hidden char *libxl__json_object_to_json(libxl__gc *gc,
                                          const libxl__json_object *args);
 /* Always return a valid string, but invalid json on error. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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