Commit 1885374802245f5d338dc29e6866525e10dc0a19

Con Kolivas 2012-02-11T22:01:51

Merge pull request #112 from luke-jr/jansson_compat Restore compatibility with Jansson 1.3 and 2.0 (api.c required 2.1)

diff --git a/api.c b/api.c
index b2013f8..5a19938 100644
--- a/api.c
+++ b/api.c
@@ -1477,7 +1477,13 @@ void api(void)
 
 					param = NULL;
 
+#if JANSSON_MAJOR_VERSION > 2 || (JANSSON_MAJOR_VERSION == 2 && JANSSON_MINOR_VERSION > 0)
 					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)) {
 						strcpy(io_buffer, message(MSG_INVJSON, 0, NULL, isjson));
diff --git a/cgminer.c b/cgminer.c
index b3c339a..00fc686 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -909,7 +909,11 @@ static char *load_config(const char *arg, void __maybe_unused *unused)
 	json_error_t err;
 	json_t *config;
 
+#if JANSSON_MAJOR_VERSION > 1
 	config = json_load_file(arg, 0, &err);
+#else
+	config = json_load_file(arg, &err);
+#endif
 	if (!json_is_object(config))
 		return "JSON decode of file failed";