mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
added Print function call for pre-allocated buffer
This commit is contained in:

committed by
Max Bruckner

parent
d0a9f46888
commit
23dafa4739
10
cJSON.c
10
cJSON.c
@ -886,6 +886,16 @@ char *cJSON_PrintBuffered(const cJSON *item, int prebuffer, cjbool fmt)
|
||||
return print_value(item, 0, fmt, &p);
|
||||
}
|
||||
|
||||
int cJSON_PrintMallocedBuffer(cJSON *item,char *buf,const int len, cjbool fmt)
|
||||
{
|
||||
char *out;
|
||||
printbuffer p;
|
||||
p.buffer = buf;
|
||||
p.length = len;
|
||||
p.offset = 0;
|
||||
out = print_value(item,0,fmt,&p);
|
||||
return (out != buf ? -1 : 0);
|
||||
}
|
||||
|
||||
/* Parser core - when encountering text, process appropriately. */
|
||||
static const char *parse_value(cJSON *item, const char *value, const char **ep)
|
||||
|
Reference in New Issue
Block a user