vis

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

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

commit d341361f1ea587751c3a7cf941437e7b8aa09221
parent 0f884a27fcb5f7e0f134859af4c97dcda64977e1
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun,  3 Apr 2016 13:16:45 +0200

buffer: add buffer_content utility function

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

diff --git a/buffer.c b/buffer.c @@ -99,3 +99,7 @@ size_t buffer_length0(Buffer *buf) { size_t buffer_length(Buffer *buf) { return buf->len; } + +const char *buffer_content(Buffer *buf) { + return buf->data; +} diff --git a/buffer.h b/buffer.h @@ -42,5 +42,7 @@ bool buffer_prepend0(Buffer*, const char *data); size_t buffer_length0(Buffer*); /* return length of a buffer including possible NUL byte */ size_t buffer_length(Buffer*); +/* pointer to buffer data, might be NULL if empty, might not be NUL terminated */ +const char *buffer_content(Buffer*); #endif