diff options
| author | Matthias Braun <matze@braunis.de> | 2015-01-04 21:41:59 -0800 |
|---|---|---|
| committer | Matthias Braun <matze@braunis.de> | 2015-01-04 21:41:59 -0800 |
| commit | 6df5538a248185d097626f7d756ded13a7447186 (patch) | |
| tree | 3940e0bb4761127f74397c98147489a872c25284 | |
| parent | 1dba77b9704734cae7d1d683ae0f5d88acb3ed9a (diff) | |
| download | vis-6df5538a248185d097626f7d756ded13a7447186.tar.gz vis-6df5538a248185d097626f7d756ded13a7447186.tar.xz | |
no need to allocate len+1 if we're not appending '\0'
| -rw-r--r-- | vis.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |
