diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-04-29 19:08:48 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-04-29 19:16:26 +0200 |
commit | da3c187d5e3f8dae63014a4dab0dd2c72baed2d5 (patch) | |
tree | 02ee3af8f92fd64394dee7f05f920f2487b11254 /src/buffer.h | |
parent | 8b9ec201edf157f84735b8d220c10edafd9f4b5a (diff) | |
download | libgit2-da3c187d5e3f8dae63014a4dab0dd2c72baed2d5.tar.gz |
buf: add git_buf_len() accessor to expose the current length of the buffer content
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/buffer.h b/src/buffer.h index 294ff6961..1cf588a62 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -93,11 +93,16 @@ GIT_INLINE(int) git_buf_joinpath(git_buf *buf, const char *a, const char *b) return git_buf_join(buf, '/', a, b); } -GIT_INLINE(const char *) git_buf_cstr(git_buf *buf) +GIT_INLINE(const char *) git_buf_cstr(const git_buf *buf) { return buf->ptr; } +GIT_INLINE(size_t) git_buf_len(const git_buf *buf) +{ + return buf->size; +} + void git_buf_copy_cstr(char *data, size_t datasize, const git_buf *buf); #define git_buf_PUTS(buf, str) git_buf_put(buf, str, sizeof(str) - 1) |