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

Function cJSON_PrintFlushed

lib/cJSON.c:987–1009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

985}
986
987int cJSON_PrintFlushed(cJSON *item, char *buf, const int len, const int fmt, flush_fn *func, void *param)
988{
989 printbuffer p;
990 int ret;
991
992 if (len < 0)
993 {
994 return false;
995 }
996
997 memset(&p, 0, sizeof(p));
998 p.buffer = (unsigned char*)buf;
999 p.length = (size_t)len;
1000 p.offset = 0;
1001 p.noalloc = true;
1002 p.flush = func;
1003 p.flush_p = param;
1004 ret = (print_value(item, 0, fmt, &p) != NULL);
1005 if (!ret || !p.offset)
1006 return ret;
1007 /* flush everything in the end */
1008 return (p.flush)(p.buffer, p.offset + 1/* last } */, p.flush_p) > 0;
1009}
1010
1011/* Parser core - when encountering text, process appropriately. */
1012static const unsigned char *parse_value(cJSON *item, const unsigned char *value, const unsigned char **ep)

Callers 1

print_mi_response_flushFunction · 0.85

Calls 1

print_valueFunction · 0.70

Tested by

no test coverage detected