commit 6abb551fddf1dbf5a57974f31ad4b8898907c84d parent 97bdf13b590a633f66263ea0fca4476cc666b2ba Author: Benno Schulenberg <bensberg@telfort.nl> Date: Sat, 2 Dec 2017 17:55:27 +0100 tweaks: avoid incrementing a variable that won't be used again later Diffstat:
M | src/text.c | | | 7 | +++---- |
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/text.c b/src/text.c @@ -1623,10 +1623,9 @@ bool do_wrap(filestruct *line) #ifndef NANO_TINY add_undo(ADD); #endif - line_len++; - line->data = charealloc(line->data, line_len + 1); - line->data[line_len - 1] = ' '; - line->data[line_len] = '\0'; + line->data = charealloc(line->data, line_len + 2); + line->data[line_len] = ' '; + line->data[line_len + 1] = '\0'; after_break = line->data + wrap_loc; after_break_len++; openfile->totsize++;