aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2011-05-09 22:10:16 -0400
committerJeff Garzik <jgarzik@pobox.com>2011-05-09 22:10:16 -0400
commit6a3b05e6504e1438e598156531a6ea58e20c0c4a (patch)
treee64e85d00aa35a157efcfdac91d84d61da7e802b /util.c
parent7ff1280bbbd1feb28ce350e2878a4e65fe94627a (diff)
jansson 2.x compatibility
Diffstat (limited to 'util.c')
-rw-r--r--util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/util.c b/util.c
index 72a086a..b6c3c60 100644
--- a/util.c
+++ b/util.c
@@ -22,6 +22,12 @@
#include "miner.h"
#include "elist.h"
+#if JANSSON_MAJOR_VERSION >= 2
+#define JSON_LOADS(str, err_ptr) json_loads((str), 0, (err_ptr))
+#else
+#define JSON_LOADS(str, err_ptr) json_loads((str), (err_ptr))
+#endif
+
struct data_buffer {
void *buf;
size_t len;
@@ -269,7 +275,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
free(hi.lp_path);
hi.lp_path = NULL;
- val = json_loads(all_data.buf, &err);
+ val = JSON_LOADS(all_data.buf, &err);
if (!val) {
applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text);
goto err_out;