mirror of
https://github.com/kgabis/parson.git
synced 2025-02-05 17:05:29 +00:00
Skip whitespace at the start of string/file
This commit is contained in:
parent
148e0ccbef
commit
ce73431753
5
parson.c
5
parson.c
@ -619,7 +619,10 @@ JSON_Value * json_parse_file_with_comments(const char *filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSON_Value * json_parse_string(const char *string) {
|
JSON_Value * json_parse_string(const char *string) {
|
||||||
if (!string || (*string != '{' && *string != '['))
|
if (!string)
|
||||||
|
return NULL;
|
||||||
|
skip_whitespaces(&string);
|
||||||
|
if (*string != '{' && *string != '[')
|
||||||
return NULL;
|
return NULL;
|
||||||
return parse_value((const char**)&string, 0);
|
return parse_value((const char**)&string, 0);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
[
|
[
|
||||||
"JSON Test Pattern pass1",
|
"JSON Test Pattern pass1",
|
||||||
{"object with 1 member":["array with 1 element"]},
|
{"object with 1 member":["array with 1 element"]},
|
||||||
|
Loading…
Reference in New Issue
Block a user