istream_new_gbuffer()
#
Creates a new gbuffer_t *
for the specified istream. The old gbuffer_t *
associated with the istream is released. The new buffer is initialized with the specified data and maximum sizes.
Prototype
PUBLIC int istream_new_gbuffer(
istream_h istream,
size_t data_size,
size_t max_size
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The handle to the istream where the new |
|
|
The size of the initial data allocation for the new |
|
|
The maximum size the new |
Return Value
Returns 0
on success.
Returns -1
if the istream
is NULL
, or if memory allocation fails.
Notes
The previous
gbuffer_t *
is decremented and freed usingGBUFFER_DECREF
before assigning the new buffer.This function logs an error if the
istream
isNULL
or if the new buffer creation fails.Ensure that the
istream
is valid before calling this function to avoid memory errors.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples