MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / parse_value

Function parse_value

modules/freeswitch/esl/src/esl_json.c:291–303  ·  view source on GitHub ↗

Parser core - when encountering text, process appropriately. */

Source from the content-addressed store, hash-verified

289
290/* Parser core - when encountering text, process appropriately. */
291static const char *parse_value(cJSON *item,const char *value)
292{
293 if (!value) return 0; /* Fail on null. */
294 if (!strncmp(value,"null",4)) { item->type=cJSON_NULL; return value+4; }
295 if (!strncmp(value,"false",5)) { item->type=cJSON_False; return value+5; }
296 if (!strncmp(value,"true",4)) { item->type=cJSON_True; item->valueint=1; return value+4; }
297 if (*value=='\"') { return parse_string(item,value); }
298 if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); }
299 if (*value=='[') { return parse_array(item,value); }
300 if (*value=='{') { return parse_object(item,value); }
301
302 ep=value;return 0; /* failure. */
303}
304
305/* Render a value to text. */
306static char *print_value(cJSON *item,int depth,int fmt)

Callers 3

cJSON_ParseFunction · 0.70
parse_arrayFunction · 0.70
parse_objectFunction · 0.70

Calls 4

parse_stringFunction · 0.70
parse_numberFunction · 0.70
parse_arrayFunction · 0.70
parse_objectFunction · 0.70

Tested by

no test coverage detected