summaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2011-11-29 16:39:49 -0800
committerRussell Belfer <arrbee@arrbee.com>2011-11-29 16:39:49 -0800
commitc63728cd73c14093665880b26505418581d7a29a (patch)
treedbb5b0645b57324310c1fde7436832663b5a72b4 /src/buffer.h
parentfc88a8d321541165b52d2cdb27753bab76870321 (diff)
downloadlibgit2-c63728cd73c14093665880b26505418581d7a29a.tar.gz
Make git_buf functions always maintain a valid cstr.
At a tiny cost of 1 extra byte per allocation, this makes git_buf_cstr into basically a noop, which simplifies error checking when trying to convert things to use dynamic allocation. This patch also adds a new function (git_buf_copy_cstr) for copying the cstr data directly into an external buffer.
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 2ed9047ca..9e8ebd058 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -42,6 +42,7 @@ void git_buf_join(git_buf *buf, char separator, const char *str_a, const char *s
const char *git_buf_cstr(git_buf *buf);
char *git_buf_take_cstr(git_buf *buf);
+void git_buf_copy_cstr(char *data, size_t datasize, git_buf *buf);
#define git_buf_PUTS(buf, str) git_buf_put(buf, str, sizeof(str) - 1)