Displaying 7 results from an estimated 7 matches for "json_decref".
2017 Nov 23
1
Re: [PATCH 1/1] Switch from YAJL to Jansson
...REE_FREE __attribute__((cleanup(cleanup_yajl_tree_free)))
>+#define CLEANUP_JSON_T_DECREF __attribute__((cleanup(cleanup_json_t_decref)))
>
> static void
>-cleanup_yajl_tree_free (void *ptr)
>+cleanup_json_t_decref (void *ptr)
> {
>- yajl_tree_free (* (yajl_val *) ptr);
>+ json_decref (* (json_t **) ptr);
> }
>
Looks like you don't need to do this, there already is 'json_auto_t' type that
has attribute cleanup with json_decref already.
2018 Feb 12
0
[PATCH v2 1/1] Switch from YAJL to Jansson
...snprintf (buf, sizeof buf, "JSON parse error: %s", err.text);
else
snprintf (buf, sizeof buf, "unknown JSON parse error");
caml_invalid_argument (buf);
}
- rv = convert_yajl_value (tree, 1);
- yajl_tree_free (tree);
+ rv = convert_json_t (tree, 1);
+ json_decref (tree);
CAMLreturn (rv);
}
diff --git a/contrib/p2v/aux-scripts/do-build.sh b/contrib/p2v/aux-scripts/do-build.sh
index 5edb53d0e..dd6424bb4 100644
--- a/contrib/p2v/aux-scripts/do-build.sh
+++ b/contrib/p2v/aux-scripts/do-build.sh
@@ -53,8 +53,8 @@ case $osversion in
# This just for...
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
2017 Nov 23
0
[PATCH 1/1] Switch from YAJL to Jansson
...snprintf (buf, sizeof buf, "JSON parse error: %s", err.text);
else
snprintf (buf, sizeof buf, "unknown JSON parse error");
caml_invalid_argument (buf);
}
- rv = convert_yajl_value (tree, 1);
- yajl_tree_free (tree);
+ rv = convert_json_t (tree, 1);
+ json_decref (tree);
CAMLreturn (rv);
}
diff --git a/builder/yajl_tests.ml b/builder/yajl_tests.ml
index f5a44f2fa..3d780d4f1 100644
--- a/builder/yajl_tests.ml
+++ b/builder/yajl_tests.ml
@@ -82,6 +82,7 @@ let test_tree_parse_invalid ctx =
assert_raises_invalid_argument "";
assert_raises_...
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
2018 Sep 13
1
[PATCH] lib: direct: Query qemu binary for availability of KVM (RHBZ#1605071).
...a/lib/qemu.c
+++ b/lib/qemu.c
@@ -46,6 +46,19 @@
#include "guestfs-internal.h"
#include "guestfs_protocol.h"
+#ifdef HAVE_ATTRIBUTE_CLEANUP
+#define CLEANUP_JSON_T_DECREF __attribute__((cleanup(cleanup_json_t_decref)))
+
+static void
+cleanup_json_t_decref (void *ptr)
+{
+ json_decref (* (json_t **) ptr);
+}
+
+#else
+#define CLEANUP_JSON_T_DECREF
+#endif
+
struct qemu_data {
int generation; /* MEMO_GENERATION read from qemu.stat */
uint64_t prev_size; /* Size of qemu binary when cached. */
@@ -54,10 +67,12 @@ struct qemu_data {
char *qemu_help;...
2018 Aug 23
2
[PATCH 1/2] mltools: JSON: add json_parser_tree_parse_file
...xt) > 0)
+ snprintf (buf, sizeof buf, "%s: JSON parse error: %s", String_val (filev), err.text);
+ else
+ snprintf (buf, sizeof buf, "%s: unknown JSON parse error", String_val (filev));
+ caml_invalid_argument (buf);
+ }
+
+ rv = convert_json_t (tree, 1);
+ json_decref (tree);
+
+ CAMLreturn (rv);
+}
diff --git a/common/mltools/JSON_parser.ml b/common/mltools/JSON_parser.ml
index 642e24d65..7c01ddf04 100644
--- a/common/mltools/JSON_parser.ml
+++ b/common/mltools/JSON_parser.ml
@@ -21,6 +21,7 @@ open Tools_utils
open Common_gettext.Gettext
external json_pars...