mirror of
https://github.com/DaveGamble/cJSON.git
synced 2024-12-27 14:14:07 +08:00
print: Comment about why the buffer is reallocated
This commit is contained in:
parent
7cc52f6035
commit
1723a94b53
2
cJSON.c
2
cJSON.c
@ -1110,6 +1110,8 @@ static unsigned char *print(const cJSON * const item, cJSON_bool format, const i
|
|||||||
}
|
}
|
||||||
update_offset(buffer);
|
update_offset(buffer);
|
||||||
|
|
||||||
|
/* Reallocate the buffer so that it only uses as much as it needs.
|
||||||
|
This can save up to 50% because ensure increases the buffer size by a factor of 2 */
|
||||||
/* check if reallocate is available */
|
/* check if reallocate is available */
|
||||||
if (hooks->reallocate != NULL)
|
if (hooks->reallocate != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user