MCPcopy Create free account
hub / github.com/acl-dev/acl / cJSON_ParseWithOpts

Function cJSON_ParseWithOpts

lib_acl/samples/json/json5/cJSON.cpp:323–337  ·  view source on GitHub ↗

Parse an object - create a new root, and populate. */

Source from the content-addressed store, hash-verified

321
322/* Parse an object - create a new root, and populate. */
323cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated)
324{
325 const char *end=0;
326 cJSON *c=cJSON_New_Item();
327 ep=0;
328 if (!c) return 0; /* memory fail */
329
330 end=parse_value(c,skip(value));
331 if (!end) {cJSON_Delete(c);return 0;} /* parse failure. ep is set. */
332
333 /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */
334 if (require_null_terminated) {end=skip(end);if (*end) {cJSON_Delete(c);ep=end;return 0;}}
335 if (return_parse_end) *return_parse_end=end;
336 return c;
337}
338/* Default options for cJSON_Parse */
339cJSON *cJSON_Parse(const char *value) {return cJSON_ParseWithOpts(value,0,0);}
340

Callers 1

cJSON_ParseFunction · 0.85

Calls 4

cJSON_New_ItemFunction · 0.85
parse_valueFunction · 0.85
skipFunction · 0.85
cJSON_DeleteFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…