You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
897 B

=proto
void *duk_resize_buffer(duk_context *ctx, int index, size_t new_size);
=stack
[ ... val! ... ]
=summary
<p>Resize a dynamic buffer at <code>index</code> to <code>new_size</code> bytes.
If <code>new_size</code> is larger than the current size, newly allocated bytes
(above old size) are automatically zeroed. Returns a pointer to the new buffer
data area. If <code>new_size</code> is zero, may return either <code>NULL</code> or some
non-<code>NULL</code> value. If resizing fails, the value at <code>index</code> is not
a dynamic buffer, or <code>index</code> is invalid, throws an error.</p>
=example
void *ptr;
ptr = duk_resize_buffer(ctx, -3, 4096);
=tags
stack
buffer
=fixme
Currently the buffer is "snug" i.e. there is no spare area (which is supported
internally). Expose this somehow, or manage spare automatically and use
something like "compact" to make the buffer snug?