mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-04 09:25:41 +02:00
A container object makes the state transitions more straightforward
And should make it possible to free an object that has just been read and still know what the next state will be, importantly.
This commit is contained in:
@@ -76,10 +76,10 @@ void json_print(json_object *j, int depth) {
|
||||
}
|
||||
|
||||
void process(FILE *f) {
|
||||
json_pull *jp = json_begin(f);
|
||||
json_object *j = NULL;
|
||||
char *error = NULL;
|
||||
|
||||
while ((j = json_parse(f, j, &error)) != NULL) {
|
||||
while ((j = json_parse(jp)) != NULL) {
|
||||
if (j->parent == NULL) {
|
||||
json_print(j, 0);
|
||||
printf("\n");
|
||||
@@ -87,8 +87,8 @@ void process(FILE *f) {
|
||||
}
|
||||
}
|
||||
|
||||
if (error != NULL) {
|
||||
fprintf(stderr, "%s\n", error);
|
||||
if (jp->error != NULL) {
|
||||
fprintf(stderr, "%s\n", jp->error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user