Parser core - when encountering text, process appropriately. */
| 356 | |
| 357 | /* Parser core - when encountering text, process appropriately. */ |
| 358 | static const char *parse_value(cJSON *item,const char *value) |
| 359 | { |
| 360 | if (!value) return 0; /* Fail on null. */ |
| 361 | if (!strncmp(value,"null",4)) { item->type=cJSON_NULL; return value+4; } |
| 362 | if (!strncmp(value,"false",5)) { item->type=cJSON_False; return value+5; } |
| 363 | if (!strncmp(value,"true",4)) { item->type=cJSON_True; item->valueint=1; return value+4; } |
| 364 | if (*value=='\"') { return parse_string(item,value); } |
| 365 | if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); } |
| 366 | if (*value=='[') { return parse_array(item,value); } |
| 367 | if (*value=='{') { return parse_object(item,value); } |
| 368 | |
| 369 | ep=value;return 0; /* failure. */ |
| 370 | } |
| 371 | |
| 372 | /* Render a value to text. */ |
| 373 | static char *print_value(cJSON *item,int depth,int fmt,printbuffer *p) |
no test coverage detected