summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-09-05 21:38:56 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-09-09 13:12:11 +0200
commitc7c3051328f605255c485cc49f58d16c7556d8f2 (patch)
tree0a5b4088b9cb76708895c7d1d1027e2f5f6bfb84 /src/buffer.c
parentb87600cb6b80678f1ef8ca994785a4ba733c2133 (diff)
downloadlibgit2-c7c3051328f605255c485cc49f58d16c7556d8f2.tar.gz
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>
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 3cdc62f6d..e92b2ef9e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -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;
+}