mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Add the whole-tree reader
This commit is contained in:
+16
@@ -55,6 +55,10 @@ json_pull *json_begin_string(char *s) {
|
||||
return json_begin(read_string, peek_string, s);
|
||||
}
|
||||
|
||||
void json_end(json_pull *p) {
|
||||
free(p);
|
||||
}
|
||||
|
||||
static int read_wrap(json_pull *j) {
|
||||
int c = j->read(j);
|
||||
|
||||
@@ -475,6 +479,18 @@ json_object *json_read(json_pull *j) {
|
||||
return json_read_with_separators(j, NULL, NULL);
|
||||
}
|
||||
|
||||
json_object *json_read_tree(json_pull *p) {
|
||||
json_object *j;
|
||||
|
||||
while ((j = json_read(p)) != NULL) {
|
||||
if (j->parent == NULL) {
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void json_free(json_object *o) {
|
||||
int i;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user