Fix the apps/json_parse "-s" (strict) option so it actually does something, and default to non-strict.
This commit is contained in:
@@ -74,11 +74,14 @@ static int parseit(int fd, int (*callback)(struct json_object *))
|
|||||||
fprintf(stderr, "unable to allocate json_tokener: %s\n", strerror(errno));
|
fprintf(stderr, "unable to allocate json_tokener: %s\n", strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
json_tokener_set_flags(tok, JSON_TOKENER_STRICT
|
if (strict_mode)
|
||||||
#ifdef JSON_TOKENER_ALLOW_TRAILING_CHARS
|
{
|
||||||
| JSON_TOKENER_ALLOW_TRAILING_CHARS
|
json_tokener_set_flags(tok, JSON_TOKENER_STRICT
|
||||||
#endif
|
#ifdef JSON_TOKENER_ALLOW_TRAILING_CHARS
|
||||||
);
|
| JSON_TOKENER_ALLOW_TRAILING_CHARS
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// XXX push this into some kind of json_tokener_parse_fd API?
|
// XXX push this into some kind of json_tokener_parse_fd API?
|
||||||
// json_object_from_fd isn't flexible enough, and mirroring
|
// json_object_from_fd isn't flexible enough, and mirroring
|
||||||
|
|||||||
Reference in New Issue
Block a user