buf: add git_buf_len() accessor to expose the current length of the buffer content

This commit is contained in:
nulltoken 2012-04-29 19:08:48 +02:00
parent 8b9ec201ed
commit da3c187d5e

View File

@ -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)