mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
libxl: Convert libxl__json_parse() to use json-c
This reuse the "json_callback_*" implemented for the yajl parser as they don't really need to be changed. It's just awkward to have to cast between `unsigned char` and `char.` Replace few strncpy() by memcpy() to let the compiler know we want to copy the string without the terminating nul, as we are adding it just after. Also, it should be possible to keep using YAJL parser when json-c library isn't available. Signed-off-by: Anthony PERARD <anthony.perard@vates.tech> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
This commit is contained in:
1 parent
bb3da1c885
commit
7e95dab9eb
2 files changed
+120
-4
No files matched your search
@@ -42,6 +42,7 @@ yajl_gen_status libxl_ms_vm_genid_gen_json(yajl_gen hand, libxl_ms_vm_genid *p);
|
||||
# define HAVE_YAJL_V2 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBYAJL
|
||||
#ifdef HAVE_YAJL_V2
|
||||
|
||||
typedef size_t libxl_yajl_length;
|
||||
@@ -89,5 +90,8 @@ static inline yajl_gen libxl_yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
|
||||
}
|
||||
|
||||
#endif /* !HAVE_YAJL_V2 */
|
||||
#else
|
||||
typedef size_t libxl_yajl_length;
|
||||
#endif /* !HAVE_LIBYAJL */
|
||||
|
||||
#endif /* LIBXL_JSON_H */
|
||||