jansson 2.x compatibility
This commit is contained in:
parent
7ff1280bbb
commit
6a3b05e650
1 changed files with 7 additions and 1 deletions
8
util.c
8
util.c
|
@ -22,6 +22,12 @@
|
||||||
#include "miner.h"
|
#include "miner.h"
|
||||||
#include "elist.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 {
|
struct data_buffer {
|
||||||
void *buf;
|
void *buf;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -269,7 +275,7 @@ json_t *json_rpc_call(CURL *curl, const char *url,
|
||||||
free(hi.lp_path);
|
free(hi.lp_path);
|
||||||
hi.lp_path = NULL;
|
hi.lp_path = NULL;
|
||||||
|
|
||||||
val = json_loads(all_data.buf, &err);
|
val = JSON_LOADS(all_data.buf, &err);
|
||||||
if (!val) {
|
if (!val) {
|
||||||
applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text);
|
applog(LOG_ERR, "JSON decode failed(%d): %s", err.line, err.text);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
Loading…
Reference in a new issue