summaryrefslogtreecommitdiff
path: root/json.h
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-09-22 09:51:48 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-09-22 09:51:48 -0400
commitb6bfc6707e1bf47acc9cd1f55ef222ad34a34c42 (patch)
treeab3542a7e0438f139c32c1f984fb2928904876de /json.h
parent3fedfc96ff25ed799aed441c2ac702dd168a44e5 (diff)
downloadgpsd-b6bfc6707e1bf47acc9cd1f55ef222ad34a34c42.tar.gz
Implement and test extended JSON array parsing.
Now supported: JSON arrays with int, unit, bool, and real elements. All regressiion tests pass.
Diffstat (limited to 'json.h')
-rw-r--r--json.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/json.h b/json.h
index 26befdad..47e2671a 100644
--- a/json.h
+++ b/json.h
@@ -32,6 +32,18 @@ struct json_array_t {
char *store;
int storelen;
} strings;
+ struct {
+ int *store;
+ } integers;
+ struct {
+ unsigned int *store;
+ } uintegers;
+ struct {
+ double *store;
+ } reals;
+ struct {
+ bool *store;
+ } booleans;
} arr;
int *count, maxlen;
};
@@ -87,7 +99,7 @@ void json_enable_debug(int, FILE *);
#define JSON_ERR_NOBRAK 6 /* array element specified, but no [ */
#define JSON_ERR_STRLONG 7 /* string value too long */
#define JSON_ERR_TOKLONG 8 /* token value too long */
-#define JSON_ERR_BADTRAIL 9 /* garbage while expecting comma, }, or ] */
+#define JSON_ERR_BADTRAIL 9 /* garbage while expecting comma or } or ] */
#define JSON_ERR_ARRAYSTART 10 /* didn't find expected array start */
#define JSON_ERR_OBJARR 11 /* error while parsing object array */
#define JSON_ERR_SUBTOOLONG 12 /* too many array elements */