print: Comment about why the buffer is reallocated

This commit is contained in:
Max Bruckner
2018-08-03 07:28:31 +02:00
parent 86234db095
commit c21efcbaee
+2
View File
@@ -1109,6 +1109,8 @@ static unsigned char *print(const cJSON * const item, cJSON_bool format, const i
}
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 */
if (hooks->reallocate != NULL)
{