Browse Source

Restore compatibility with Jansson 1.3 and 2.0 (api.c required 2.1)

nfactor-troky
Luke Dashjr 13 years ago
parent
commit
fdadb0b549
  1. 6
      api.c
  2. 4
      cgminer.c

6
api.c

@ -1476,7 +1476,13 @@ void api(void)
param = NULL; param = NULL;
#if JANSSON_MAJOR_VERSION > 2 || (JANSSON_MAJOR_VERSION == 2 && JANSSON_MINOR_VERSION > 0)
json_config = json_loadb(buf, n, 0, &json_err); json_config = json_loadb(buf, n, 0, &json_err);
#elif JANSSON_MAJOR_VERSION > 1
json_config = json_loads(buf, 0, &json_err);
#else
json_config = json_loads(buf, &json_err);
#endif
if (!json_is_object(json_config)) { if (!json_is_object(json_config)) {
strcpy(io_buffer, message(MSG_INVJSON, 0, NULL, isjson)); strcpy(io_buffer, message(MSG_INVJSON, 0, NULL, isjson));

4
cgminer.c

@ -914,7 +914,11 @@ static char *load_config(const char *arg, void __maybe_unused *unused)
json_error_t err; json_error_t err;
json_t *config; json_t *config;
#if JANSSON_MAJOR_VERSION > 1
config = json_load_file(arg, 0, &err); config = json_load_file(arg, 0, &err);
#else
config = json_load_file(arg, &err);
#endif
if (!json_is_object(config)) if (!json_is_object(config))
return "JSON decode of file failed"; return "JSON decode of file failed";

Loading…
Cancel
Save