json_encoder_reserve_space()
QNX SDP8.0JSON Library ReferenceAPIDeveloper
Reserve space for a given number of bytes in the JSON encoder's buffer
Synopsis:
#include <sys/json.h>
json_encoder_error_t json_encoder_reserve_space(json_encoder_t *encoder,
int length)
Arguments:
- encoder
- The JSON encoder instance.
- length
- The number of bytes of free space required.
Library:
libjsonDescription:
Reserving space can speed up encoding if it is known in advance that a large amount of space is required. If json_encoder_access_buffer() is used to obtain a pointer that allows additional data to be written at the end of the JSON string, json_encoder_reserve_space() can be used to ensure that there is space for the data.
Note:
This call is not applicable to encoder instances obtained from json_decoder_get_encoder(), since JSON items encoded with these encoders are added directly to the decoder tree rather than into a JSON-formatted buffer.
Returns:
- JSON_ENCODER_OK
- Success.
- JSON_ENCODER_NO_MEMORY
- There is not enough memory to perform the operation.
- JSON_ENCODER_NOT_SUPPORTED
- The encoder instance was obtained from json_decoder_get_encoder().
Page updated: