summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-11 14:23:39 -0700
committerRussell Belfer <rb@github.com>2013-09-17 09:31:45 -0700
commit40cb40fab93281c808255d980bbe81a18a4d9e9a (patch)
tree349cfd168a3a704288a3222f69374064e7d86c91 /src/buffer.c
parent0646634e2fea3e0adf724e0b7b15118574b589fc (diff)
downloadlibgit2-40cb40fab93281c808255d980bbe81a18a4d9e9a.tar.gz
Add functions to manipulate filter lists
Extend the git2/sys/filter API with functions to look up a filter and add it manually to a filter list. This requires some trickery because the regular attribute lookups and checks are bypassed when this happens, but in the right hands, it will allow a user to have granular control over applying filters.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index aaebac776..07725b9cc 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -548,9 +548,10 @@ int git_buffer_resize(git_buffer *buffer, size_t want_size)
int git_buffer_copy(
git_buffer *buffer, const void *data, size_t datalen)
{
- if (git_buffer__resize(buffer, datalen, false) < 0)
+ if (git_buffer__resize(buffer, datalen + 1, false) < 0)
return -1;
memcpy(buffer->ptr, data, datalen);
+ buffer->ptr[datalen] = '\0';
buffer->size = datalen;
return 0;
}