aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buffer.c4
-rw-r--r--buffer.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index c4830d6..b9733c2 100644
--- a/buffer.c
+++ b/buffer.c
@@ -95,3 +95,7 @@ size_t buffer_length0(Buffer *buf) {
len--;
return len;
}
+
+size_t buffer_length(Buffer *buf) {
+ return buf->len;
+}
diff --git a/buffer.h b/buffer.h
index 7e3c342..fcdad47 100644
--- a/buffer.h
+++ b/buffer.h
@@ -40,5 +40,7 @@ bool buffer_prepend(Buffer*, const void *data, size_t len);
bool buffer_prepend0(Buffer*, const char *data);
/* return length of a buffer without trailing NUL byte */
size_t buffer_length0(Buffer*);
+/* return length of a buffer including possible NUL byte */
+size_t buffer_length(Buffer*);
#endif