Skip to content

Commit

Permalink
jansson 2.x compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Garzik authored and jgarzik committed May 10, 2011
1 parent 7ff1280 commit 6a3b05e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6a3b05e

Please sign in to comment.