MCPcopy Create free account
hub / github.com/esnet/iperf / cJSON_PrintBuffered

Function cJSON_PrintBuffered

src/cjson.c:1273–1301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1271}
1272
1273CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt)
1274{
1275 printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };
1276
1277 if (prebuffer < 0)
1278 {
1279 return NULL;
1280 }
1281
1282 p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer);
1283 if (!p.buffer)
1284 {
1285 return NULL;
1286 }
1287
1288 p.length = (size_t)prebuffer;
1289 p.offset = 0;
1290 p.noalloc = false;
1291 p.format = fmt;
1292 p.hooks = global_hooks;
1293
1294 if (!print_value(item, &p))
1295 {
1296 global_hooks.deallocate(p.buffer);
1297 return NULL;
1298 }
1299
1300 return (char*)p.buffer;
1301}
1302
1303CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format)
1304{

Callers

nothing calls this directly

Calls 1

print_valueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…