From 6df5538a248185d097626f7d756ded13a7447186 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sun, 4 Jan 2015 21:41:59 -0800 Subject: no need to allocate len+1 if we're not appending '\0' --- vis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index ca086b8..793e9a4 100644 --- a/vis.c +++ b/vis.c @@ -627,7 +627,7 @@ static void op_shift_left(OperatorContext *c) { static void op_case_change(OperatorContext *c) { size_t len = c->range.end - c->range.start; - char *buf = malloc(len+1); + char *buf = malloc(len); if (!buf) return; len = text_bytes_get(vis->win->text, c->range.start, len, buf); @@ -1121,7 +1121,7 @@ static void copy_indent_from_previous_line(Win *win, Text *text) { size_t begin = text_line_begin(text, prev_line); size_t start = text_line_start(text, begin); size_t len = start-begin; - char *buf = malloc(len+1); + char *buf = malloc(len); if (!buf) return; len = text_bytes_get(text, begin, len, buf); -- cgit v1.2.3