Permalink
Browse files

Ported gnugol to libjansson2.x

There was a small API change between libjansson1.3 and 2 that needed
to be compensated for.

These patches address that and should also remain backward compatable
with jannson1.3

http://www.digip.org/jansson/doc/2.0/upgrading.html
  • Loading branch information...
1 parent e29472b commit b8bf784155b35faf8a8df46b47db98b30c6a7fe0 Dave Taht committed Apr 14, 2011
Showing with 29 additions and 0 deletions.
  1. +4 −0 src/engines/bing.c
  2. +5 −0 src/engines/googlev1.c
  3. +5 −0 src/engines/googlev2.c
  4. +4 −0 src/engines/stackapps.c
  5. +5 −0 src/engines/wikipedia.c
  6. +6 −0 src/include/gnugol_engines.h
View
@@ -149,7 +149,11 @@ int search(QueryOptions_t *q) {
if(q->debug) GNUGOL_OUTW(q,"%s: get url request succeeded: %s\n", q->engine_name, q->querystr);
+#ifdef HAVE_NEWJANSSON
+ root = json_loads(text, 0, &error);
+#else
root = json_loads(text, &error);
+#endif
free(text);
if(!root)
View
@@ -168,7 +168,12 @@ int search(QueryOptions_t *q) {
return -1;
}
+#ifdef HAVE_NEWJANSSON
+ root = json_loads(text, 0, &error);
+#else
root = json_loads(text, &error);
+#endif
+
free(text);
if(!root)
View
@@ -145,7 +145,12 @@ int search(QueryOptions_t *q) {
return 1;
}
+#ifdef HAVE_NEWJANSSON
+ root = json_loads(text, 0, &error);
+#else
root = json_loads(text, &error);
+#endif
+
free(text);
if(!root)
View
@@ -273,7 +273,11 @@ int search(QueryOptions_t *q) {
GNUGOL_OUTE(q,"url failed to work: %s", q->querystr);
return -1;
}
+#ifdef HAVE_NEWJANSSON
+ root = json_loads(text, 0, &error);
+#else
root = json_loads(text, &error);
+#endif
free(text);
if(!root)
{
View
@@ -96,7 +96,12 @@ int search(QueryOptions_t *q) {
return 1;
}
+#ifdef HAVE_NEWJANSSON
+ root = json_loads(text, 0, &error);
+#else
root = json_loads(text, &error);
+#endif
+
free(text);
if(!root)
@@ -3,6 +3,12 @@
#include "nodelist.h"
+#ifdef JANSSON_VERSION_HEX
+#if JANSSON_VERSION_HEX >= 020000
+#define HAVE_NEWJANSSON JANSSON_VERSION_HEX
+#endif
+#endif
+
#ifndef DEBUG_SHAREDLIBS
# define DEBUG_SHAREDLIBS 0
#endif

0 comments on commit b8bf784

Please sign in to comment.