A data buffer for exporting data from libgit2
Sometimes libgit2 wants to return an allocated data buffer to the
caller and have the caller take responsibility for freeing that memory.
To make ownership clear in these cases, libgit2 uses git_buf
to
return this data. Callers should use git_buf_dispose()
to release
the memory when they are done.
A git_buf
contains a pointer to a NUL-terminated C string, and
the length of the string (not including the NUL terminator).
The buffer contents. ptr
points to the start of the buffer being returned. The buffer's length (in bytes) is specified by the size
member of the structure, and contains a NUL terminator at position (size + 1)
.
This field is reserved and unused.
The length (in bytes) of the buffer pointed to by ptr
, not including a NUL terminator.