More sensible way of passing errors back to caller

This commit is contained in:
Eric Fischer
2014-02-06 12:13:23 -08:00
parent f8465828e5
commit 42283ece0b
3 changed files with 54 additions and 39 deletions
+6 -1
View File
@@ -77,14 +77,19 @@ void json_print(json_object *j, int depth) {
void process(FILE *f) {
json_object *j = NULL;
char *error = NULL;
while ((j = json_parse(f, j)) != NULL) {
while ((j = json_parse(f, j, &error)) != NULL) {
if (j->parent == NULL) {
json_print(j, 0);
printf("\n");
j = NULL;
}
}
if (error != NULL) {
fprintf(stderr, "%s\n", error);
}
}
int main(int argc, char **argv) {