mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 13:52:32 +00:00
buffer: add git_buf_consume
Moves the content after 'end' to the beginning of the buffer Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
This commit is contained in:
parent
b87600cb6b
commit
c7c3051328
@ -98,3 +98,10 @@ void git_buf_clear(git_buf *buf)
|
||||
{
|
||||
buf->size = 0;
|
||||
}
|
||||
|
||||
void git_buf_consume(git_buf *buf, const char *end)
|
||||
{
|
||||
size_t consumed = end - buf->ptr;
|
||||
memmove(buf->ptr, end, buf->size - consumed);
|
||||
buf->size -= consumed;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ void git_buf_printf(git_buf *buf, const char *format, ...) GIT_FORMAT_PRINTF(2,
|
||||
const char *git_buf_cstr(git_buf *buf);
|
||||
void git_buf_free(git_buf *buf);
|
||||
void git_buf_clear(git_buf *buf);
|
||||
void git_buf_consume(git_buf *buf, const char *end);
|
||||
|
||||
#define git_buf_PUTS(buf, str) git_buf_put(buf, str, sizeof(str) - 1)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user