]> granicus.if.org Git - json-c/commitdiff
Deprecated a few typedefs, add docs on json_object_iter, move json_number_chars and...
authorEric Haszlakiewicz <erh+git@nimenees.com>
Tue, 5 Dec 2017 14:20:59 +0000 (09:20 -0500)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Tue, 5 Dec 2017 14:20:59 +0000 (09:20 -0500)
json_object.h
json_object_private.h
json_tokener.c
json_tokener.h
tests/test_parse.c

index 83ce0660a06e07dff51af41a83241ec61e055849..3141a42923d7b36b4d4673b1d4a0e64c8f037b3b 100644 (file)
@@ -129,26 +129,35 @@ extern "C" {
  */
 #define JSON_C_OPTION_THREAD (1)
 
-extern const char *json_number_chars;
-extern const char *json_hex_chars;
-
-/* CAW: added for ANSI C iteration correctness */
+/**
+ * A structure to use with json_object_object_foreachC() loops.
+ * Contains key, val and entry members.
+ */
 struct json_object_iter
 {
        char *key;
        struct json_object *val;
        struct lh_entry *entry;
 };
+typedef struct json_object_iter json_object_iter;
 
 /* forward structure definitions */
 
-typedef int json_bool;
+/**
+ * @deprecated Unused in json-c sources
+ */
 typedef struct printbuf printbuf;
+/**
+ * @deprecated Unused in json-c sources
+ */
 typedef struct lh_table lh_table;
+/**
+ * @deprecated Unused in json-c sources
+ */
 typedef struct array_list array_list;
+
+typedef int json_bool;
 typedef struct json_object json_object;
-typedef struct json_object_iter json_object_iter;
-typedef struct json_tokener json_tokener;
 
 /**
  * Type of custom user delete functions.  See json_object_set_serializer.
@@ -531,7 +540,7 @@ JSON_EXPORT void json_object_object_del(struct json_object* obj, const char *key
 
 /** Iterate through all keys and values of an object (ANSI C Safe)
  * @param obj the json_object instance
- * @param iter the object iterator
+ * @param iter the object iterator, use type json_object_iter
  */
 #define json_object_object_foreachC(obj,iter) \
  for(iter.entry = json_object_get_object(obj)->head; \
index 325005a3fd7de3dd810a11c0d7131c9d00b12c3f..0abbca21d86a3b450b834b0b4a3f43f1ce743363 100644 (file)
@@ -50,6 +50,9 @@ struct json_object
 
 void _json_c_set_last_err(const char *err_fmt, ...);
 
+extern const char *json_number_chars;
+extern const char *json_hex_chars;
+
 #ifdef __cplusplus
 }
 #endif
index 620468e41c7d2402c7b895b61bc01a760f429c3b..449a82da6f568faa12644ebea6b8746009f8f680 100644 (file)
@@ -29,6 +29,7 @@
 #include "arraylist.h"
 #include "json_inttypes.h"
 #include "json_object.h"
+#include "json_object_private.h"
 #include "json_tokener.h"
 #include "json_util.h"
 #include "strdup_compat.h"
@@ -94,7 +95,7 @@ const char *json_tokener_error_desc(enum json_tokener_error jerr)
        return json_tokener_errors[jerr];
 }
 
-enum json_tokener_error json_tokener_get_error(json_tokener *tok)
+enum json_tokener_error json_tokener_get_error(struct json_tokener *tok)
 {
        return tok->err;
 }
index 414c9d6e2c92f09437027e1ec2cc7f0f767f53be..0ae4489922ab949733d6e8076934cb4d791a52f2 100644 (file)
@@ -86,6 +86,10 @@ struct json_tokener
   struct json_tokener_srec *stack;
   int flags;
 };
+/**
+ * @deprecated Unused in json-c code
+ */
+typedef struct json_tokener json_tokener;
 
 /**
  * Be strict when parsing JSON input.  Use caution with
index c68e1233dc34012179ed0a729d93de159fcb1702..ee1f8387b31a4ff1cb81ada76390ed617bd71db9 100644 (file)
@@ -296,7 +296,7 @@ static void test_incremental_parse()
 {
        json_object *new_obj;
        enum json_tokener_error jerr;
-       json_tokener *tok;
+       struct json_tokener *tok;
        const char *string_to_parse;
        int ii;
        int num_ok, num_error;