2.5 Buffer
(require libgit2/include/buffer) | package: libgit2 |
procedure
(git_buf_contains_nul buf) → boolean?
buf : buf?
procedure
(git_buf_free buffer) → void?
buffer : buf?
Note that this does not free the git_buf itself, just the memory pointed to by buffer->ptr. This will not free the memory if it looks like it was not allocated internally, but it will clear the buffer back to the empty state.
procedure
(git_buf_grow buffer target_size) → integer?
buffer : buf? target_size : exact-positive-integer?
This will attempt to grow the buffer to accommodate the target size.
If the buffer refers to memory that was not allocated by libgit2 (i.e. the asize field is zero), then ptr will be replaced with a newly allocated block of data. Be careful so that memory allocated by the caller is not lost. As a special variant, if you pass target_size as 0 and the memory is not allocated by libgit2, this will allocate a new buffer of size size and copy the external data into it.
Currently, this will never shrink a buffer, only expand it.
If the allocation fails, this will return an error and the buffer will be marked as invalid for future operations, invaliding the contents.
procedure
(git_buf_is_binary buf) → boolean?
buf : buf?
procedure
(git_buf_set buffer data datalen) → integer?
buffer : buf? data : bytes? datalen : exact-positive-integer?