vis

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

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

commit f19fcd3e6dc095b9cc339daa6bed4fdae0a75b16
parent 79c8caf3798b24055fb3c08f53f64357d752403c
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat,  7 Jan 2017 13:03:58 +0100

buffer: remove redundant function

For some reason we ended up with two identical functions: buffer_{clear,terminate}.

Diffstat:
Mbuffer.c | 4----
Mbuffer.h | 2--
Mvis-core.h | 2+-
3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/buffer.c b/buffer.c @@ -29,10 +29,6 @@ bool buffer_grow(Buffer *buf, size_t size) { return true; } -void buffer_truncate(Buffer *buf) { - buf->len = 0; -} - bool buffer_terminate(Buffer *buf) { return !buf->data || buf->len == 0 || buf->data[buf->len-1] == '\0' || buffer_append(buf, "\0", 1); diff --git a/buffer.h b/buffer.h @@ -20,8 +20,6 @@ void buffer_release(Buffer*); void buffer_clear(Buffer*); /* reserve space to store at least size bytes in this buffer.*/ bool buffer_grow(Buffer*, size_t size); -/* truncate buffer, but keep associated memory region for further data */ -void buffer_truncate(Buffer*); /* if buffer is not empty, make sure it is NUL terminated */ bool buffer_terminate(Buffer*); /* replace buffer content with given data, growing the buffer if needed */ diff --git a/vis-core.h b/vis-core.h @@ -91,7 +91,7 @@ typedef struct { typedef Buffer Macro; #define macro_init buffer_init #define macro_release buffer_release -#define macro_reset buffer_truncate +#define macro_reset buffer_clear #define macro_append buffer_append0 typedef struct { /** collects all information until an operator is executed */