mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 17:05:49 +00:00
buffer: add git_buf_clear
Set the size to zero so the memory that has already been allocated can be reused Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
This commit is contained in:
parent
b0bda0a4ee
commit
b87600cb6b
@ -93,3 +93,8 @@ void git_buf_free(git_buf *buf)
|
|||||||
{
|
{
|
||||||
free(buf->ptr);
|
free(buf->ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void git_buf_clear(git_buf *buf)
|
||||||
|
{
|
||||||
|
buf->size = 0;
|
||||||
|
}
|
||||||
|
@ -18,6 +18,7 @@ void git_buf_puts(git_buf *buf, const char *string);
|
|||||||
void git_buf_printf(git_buf *buf, const char *format, ...) GIT_FORMAT_PRINTF(2, 3);
|
void git_buf_printf(git_buf *buf, const char *format, ...) GIT_FORMAT_PRINTF(2, 3);
|
||||||
const char *git_buf_cstr(git_buf *buf);
|
const char *git_buf_cstr(git_buf *buf);
|
||||||
void git_buf_free(git_buf *buf);
|
void git_buf_free(git_buf *buf);
|
||||||
|
void git_buf_clear(git_buf *buf);
|
||||||
|
|
||||||
#define git_buf_PUTS(buf, str) git_buf_put(buf, str, sizeof(str) - 1)
|
#define git_buf_PUTS(buf, str) git_buf_put(buf, str, sizeof(str) - 1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user