From 753bf99f5c6ba6bdf904968d34ce6537d79e7869 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Mon, 12 Oct 2015 16:38:50 +0200 Subject: [PATCH] builder: fix conversion of double to OCaml (RHBZ#1270011). Create the OCaml value for double using caml_copy_double, which is the correct way, simplier, and works. --- builder/yajl-c.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/builder/yajl-c.c b/builder/yajl-c.c index 77ae3e749..194fa34e6 100644 --- a/builder/yajl-c.c +++ b/builder/yajl-c.c @@ -76,9 +76,8 @@ convert_yajl_value (yajl_val val, int level) Store_field (rv, 0, v); } else if (YAJL_IS_DOUBLE (val)) { rv = caml_alloc (1, 2); - lv = caml_alloc_tuple (1); - Store_double_field (lv, 0, YAJL_GET_DOUBLE(val)); - Store_field (rv, 0, lv); + v = caml_copy_double (YAJL_GET_DOUBLE(val)); + Store_field (rv, 0, v); } else if (YAJL_IS_INTEGER (val)) { rv = caml_alloc (1, 1); v = caml_copy_int64 (YAJL_GET_INTEGER(val));