MCPcopy Create free account
hub / github.com/DaveGamble/cJSON / cJSON_PrintBuffered

Function cJSON_PrintBuffered

cJSON.c:1312–1341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1310}
1311
1312CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt)
1313{
1314 printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };
1315
1316 if (prebuffer < 0)
1317 {
1318 return NULL;
1319 }
1320
1321 p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer);
1322 if (!p.buffer)
1323 {
1324 return NULL;
1325 }
1326
1327 p.length = (size_t)prebuffer;
1328 p.offset = 0;
1329 p.noalloc = false;
1330 p.format = fmt;
1331 p.hooks = global_hooks;
1332
1333 if (!print_value(item, &p))
1334 {
1335 global_hooks.deallocate(p.buffer);
1336 p.buffer = NULL;
1337 return NULL;
1338 }
1339
1340 return (char*)p.buffer;
1341}
1342
1343CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format)
1344{

Callers 3

mainFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85

Calls 1

print_valueFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…