Commit da3c187d5e3f8dae63014a4dab0dd2c72baed2d5

nulltoken 2012-04-29T19:08:48

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

diff --git a/src/buffer.h b/src/buffer.h
index 294ff69..1cf588a 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)