-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Labels
Milestone
Description
As suggested by @iMobs in #89.
It is not guaranteed, that cJSON will ever support streaming, but if it will, here's some ideas on how it could be done.
The print functions have been switched to only supporting buffered printing recently. Streaming could be done by allocating a buffer every time the ensure function is called and flushing that buffer to the stream on the next call (or when it exceeds a certain size).
An important thing to keep in mind: This buffer can not be allocated on the stack, because it needs to be able to take any length.
The streaming functions could be passed through with cJSON_Hooks or similar.
In that model, cJSON would also be the caller and the program that uses cJSON for streaming would be the callee.
Reactions are currently unavailable