dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit b1b70137cca692c67e2c4df5f7f3e56dc0dfe00b
parent 05647500bb1f4ee4f82b9b7c1b9489aeedf4c092
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Tue, 27 Nov 2012 22:58:40 +0100

vt: move buffer handling code, add missing static

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
vt.c | 24++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/vt.c b/vt.c @@ -1151,7 +1151,17 @@ void vt_set_default_colors(Vt *t, unsigned attrs, short fg, short bg) t->defbg = bg; } -bool buffer_init(Buffer *t, int rows, int cols, int scroll_buf_sz) +static void buffer_free(Buffer *t) +{ + for (int i = 0; i < t->rows; i++) + free(t->lines[i].cells); + free(t->lines); + for (int i = 0; i < t->scroll_buf_sz; i++) + free(t->scroll_buf[i].cells); + free(t->scroll_buf); +} + +static bool buffer_init(Buffer *t, int rows, int cols, int scroll_buf_sz) { Row *lines, *scroll_buf; t->lines = lines = calloc(rows, sizeof(Row)); @@ -1216,7 +1226,7 @@ Vt *vt_create(int rows, int cols, int scroll_buf_sz) return t; } -void buffer_resize(Buffer *t, int rows, int cols) +static void buffer_resize(Buffer *t, int rows, int cols) { Row *lines = t->lines; @@ -1297,16 +1307,6 @@ void vt_resize(Vt *t, int rows, int cols) kill(-t->childpid, SIGWINCH); } -void buffer_free(Buffer *t) -{ - for (int i = 0; i < t->rows; i++) - free(t->lines[i].cells); - free(t->lines); - for (int i = 0; i < t->scroll_buf_sz; i++) - free(t->scroll_buf[i].cells); - free(t->scroll_buf); -} - void vt_destroy(Vt *t) { if (!t)