git_buf

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 null-terminated C string, and the length of the string (not including the null terminator).

extern (C) nothrow @nogc public
struct git_buf {}

Members

Variables

ptr_
char* ptr_;

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 null terminator at position (size + 1).

reserved
size_t reserved;

This field is reserved and unused.

size
size_t size;

The length (in bytes) of the buffer pointed to by ptr, not including a null terminator.

Meta