Changeset 989f431 for lib/parson.c


Ignore:
Timestamp:
2015-02-22T16:15:28Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Children:
ee170a1
Parents:
782a6ee
Message:

json_parse_first() which lets me find out where it stopped parsing, needed
for safe and proper stream parsing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/parson.c

    r782a6ee r989f431  
    769769}
    770770
    771 JSON_Value * json_parse_string(const char *string) {
     771JSON_Value * json_parse_first(const char *string, const char **end) {
     772    const char *pos;
     773    JSON_Value *ret;
     774
    772775    if (!string)
    773776        return NULL;
     
    775778    if (*string != '{' && *string != '[')
    776779        return NULL;
    777     return parse_value((const char**)&string, 0);
     780
     781    pos = string;
     782    ret = parse_value(&pos, 0);
     783    if (end)
     784        *end = pos;
     785
     786    return ret;
     787}
     788
     789JSON_Value * json_parse_string(const char *string) {
     790    return json_parse_first(string, NULL);
    778791}
    779792
Note: See TracChangeset for help on using the changeset viewer.