search for: json_loads

Displaying 5 results from an estimated 5 matches for "json_loads".

2018 Feb 12
0
[PATCH v2 1/1] Switch from YAJL to Jansson
...se); } else @@ -101,21 +99,21 @@ virt_builder_yajl_tree_parse (value stringv) { CAMLparam1 (stringv); CAMLlocal1 (rv); - yajl_val tree; - char error_buf[256]; + json_t *tree; + json_error_t err; - tree = yajl_tree_parse (String_val (stringv), error_buf, sizeof error_buf); + tree = json_loads (String_val (stringv), JSON_DECODE_ANY, &err); if (tree == NULL) { - char buf[256 + sizeof error_buf]; - if (strlen (error_buf) > 0) - snprintf (buf, sizeof buf, "JSON parse error: %s", error_buf); + char buf[256 + JSON_ERROR_TEXT_LENGTH]; + if (strlen (err.text...
2017 Nov 23
0
[PATCH 1/1] Switch from YAJL to Jansson
...se); } else @@ -101,21 +99,21 @@ virt_builder_yajl_tree_parse (value stringv) { CAMLparam1 (stringv); CAMLlocal1 (rv); - yajl_val tree; - char error_buf[256]; + json_t *tree; + json_error_t err; - tree = yajl_tree_parse (String_val (stringv), error_buf, sizeof error_buf); + tree = json_loads (String_val (stringv), 0, &err); if (tree == NULL) { - char buf[256 + sizeof error_buf]; - if (strlen (error_buf) > 0) - snprintf (buf, sizeof buf, "JSON parse error: %s", error_buf); + char buf[256 + JSON_ERROR_TEXT_LENGTH]; + if (strlen (err.text) > 0) +...
2018 Feb 12
2
[PATCH v2 0/1] RFC: switch from YAJL to Jansson
Hi, recently, there was a discussion in the development list of libvirt on switching to a different JSON library than YAJL [1]. Since we use YAJL, and the points there IMHO apply to libguestfs as well, I decided to give a try in switching to Jansson [2]. The result IMHO is nice, with the additional APIs of Jansson that simplify some of our code. Unlike with YAJL, I did not set a minimum
2017 Nov 23
4
[PATCH 0/1] RFC: switch from YAJL to Jansson
Hi, recently, there was a discussion in the development list of libvirt on switching to a different JSON library than YAJL [1]. Since we use YAJL, and the points there IMHO apply to libguestfs as well, I decided to give a try in switching to Jansson [2]. The result IMHO is nice, with the additional APIs of Jansson that simplify some of our code. Unlike with YAJL, I did not set a minimum
2018 Sep 13
1
[PATCH] lib: direct: Query qemu binary for availability of KVM (RHBZ#1605071).
...: true}} + */ +static void +parse_has_kvm (guestfs_h *g, const char *json, bool *ret) +{ + CLEANUP_JSON_T_DECREF json_t *tree = NULL; + json_error_t err; + json_t *return_node, *enabled_node; + + *ret = true; /* Assume KVM is enabled. */ + + if (!json) + return; + + tree = json_loads (json, 0, &err); + if (tree == NULL) { + if (strlen (err.text) > 0) + debug (g, "QMP parse error: %s (ignored)", err.text); + else + debug (g, "QMP unknown parse error (ignored)"); + return; + } + + return_node = json_object_get (tree, "return&q...