Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

include JSON library

guard against a pre 0.10 json library bug
  • Loading branch information...
commit a8bec22b71cb7c763222556289e767621ebe5421 1 parent 8191caa
@paulrho paulrho authored
Showing with 6 additions and 1 deletion.
  1. +2 −0  Makefile.am
  2. +3 −1 bti.c
  3. +1 −0  configure.ac
View
2  Makefile.am
@@ -12,12 +12,14 @@ bti_SOURCES = \
bti_CFLAGS = \
$(LIBCURL_CFLAGS) \
$(XML_CFLAGS) \
+ $(JSON_CFLAGS) \
$(LIBPCRE_CFLAGS) \
$(LIBOAUTH_CFLAGS)
bti_LDADD = \
$(LIBCURL_LIBS) \
$(XML_LIBS) \
+ $(JSON_LIBS) \
$(LIBPCRE_LIBS) \
$(LIBOAUTH_LIBS)
View
4 bti.c
@@ -596,7 +596,9 @@ static int parse_response_json(char *document, struct session *session)
results.code=0;
results.message=NULL;
json_object * jobj = json_tokener_parse(document);
- json_parse(jobj,0);
+ if (!is_error(jobj)) { /* guards against a json pre 0.10 bug */
+ json_parse(jobj,0);
+ }
if (results.code && results.message!=NULL) {
if (debug) printf("Got an error code:\n code=%d\n message=%s\n",results.code,results.message);
fprintf(stderr, "error condition detected: %d = %s\n", results.code, results.message);
View
1  configure.ac
@@ -18,6 +18,7 @@ PKG_CHECK_MODULES(LIBOAUTH, oauth)
PKG_CHECK_MODULES(LIBPCRE, libpcre)
PKG_CHECK_MODULES([LIBCURL], [libcurl])
PKG_CHECK_MODULES([XML], [libxml-2.0])
+PKG_CHECK_MODULES([JSON], [json])
AC_SEARCH_LIBS([dlopen], [dl])
Please sign in to comment.
Something went wrong with that request. Please try again.