Merge pull request #16 from kdopen/master

Renaming the boolean type to json_bool in json_object.h
diff --git a/.gitignore b/.gitignore
index 6acd819..21b927d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,10 +17,16 @@
 Makefile.in
 missing
 stamp-h1
+stamp-h2
 test1
 test2
 test4
 testSubDir
 test_parse_int64
+test_cast
+test_null
 Debug
 Release
+*.lo
+*.o
+libjson.la
diff --git a/json_tokener.c b/json_tokener.c
index 6d973ec..04950b5 100644
--- a/json_tokener.c
+++ b/json_tokener.c
@@ -47,7 +47,7 @@
 const char* json_tokener_errors[] = {
   "success",
   "continue",
-  "nesting to deep",
+  "nesting too deep",
   "unexpected end of data",
   "unexpected character",
   "null expected",
@@ -122,17 +122,10 @@
 
 struct json_object* json_tokener_parse(const char *str)
 {
-  struct json_tokener* tok;
-  struct json_object* obj;
-
-  tok = json_tokener_new();
-  if (!tok)
-    return NULL;
-  obj = json_tokener_parse_ex(tok, str, -1);
-  if(tok->err != json_tokener_success)
-    obj = NULL;
-  json_tokener_free(tok);
-  return obj;
+    enum json_tokener_error jerr_ignored;
+    struct json_object* obj;
+    obj = json_tokener_parse_verbose(str, &jerr_ignored);
+    return obj;
 }
 
 struct json_object* json_tokener_parse_verbose(const char *str, enum json_tokener_error *error)
@@ -141,9 +134,13 @@
     struct json_object* obj;
 
     tok = json_tokener_new();
+    if (!tok)
+      return NULL;
     obj = json_tokener_parse_ex(tok, str, -1);
     *error = tok->err;
     if(tok->err != json_tokener_success) {
+		if (obj != NULL)
+			json_object_put(obj);
         obj = NULL;
     }