vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 0f884a27fcb5f7e0f134859af4c97dcda64977e1
parent e44224140389a00b58b1f36b5703314ac7f85c6d
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri,  1 Apr 2016 13:14:20 +0200

buffer: add buffer_length utility function

Diffstat:
Mbuffer.c | 4++++
Mbuffer.h | 2++
2 files changed, 6 insertions(+), 0 deletions(-)

diff --git 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 @@ -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