summaryrefslogtreecommitdiff
path: root/json.h
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-08-25 03:05:10 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-08-25 03:05:10 +0000
commit0cac724924ae8aadf9e12dd2aedc3eb0bf8de901 (patch)
tree1910a147296d1c2e6c6f1650227f205b50aa4f86 /json.h
parent9126c2d2b1c1283bdf8b48c608ede572859fb5e4 (diff)
downloadgpsd-0cac724924ae8aadf9e12dd2aedc3eb0bf8de901.tar.gz
Change the way JSON parse templates are declared...
so that string lengths won't step on offsets.
Diffstat (limited to 'json.h')
-rw-r--r--json.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/json.h b/json.h
index 0e830dce..e6505d69 100644
--- a/json.h
+++ b/json.h
@@ -32,10 +32,7 @@ struct json_attr_t {
union {
int *integer;
double *real;
- struct {
- char *ptr;
- int len;
- } string;
+ char *string;
bool *boolean;
struct json_array_t array;
size_t offset;
@@ -46,6 +43,7 @@ struct json_attr_t {
bool boolean;
char *check;
} dflt;
+ size_t len;
};
#define JSON_ATTR_MAX 31 /* max chars in JSON attribute name */
@@ -72,5 +70,6 @@ const char *json_error_string(int);
#define JSON_ERR_BADSTRING 15 /* error while string parsing */
#define JSON_ERR_CHECKFAIL 16 /* check attribute not matched */
#define JSON_ERR_BADENUM 17 /* invalid flag token */
+#define JSON_ERR_NOPARSTR 18 /* can't support strings in aparalle. arrays */
/* json.h ends here */