nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 36c83d92ddb4ad69eb91588392c6878ccaae349f
parent 9021725d5346d8cb8bda5cc5fad45959aba6f0de
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 27 May 2018 16:33:51 +0200

tweaks: stop decreasing both the iterator and the limit of a loop

Diffstat:
Msrc/text.c | 9+--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -2219,8 +2219,6 @@ void do_justify(bool full_justify) openfile->current = openfile->fileage; while (TRUE) { - size_t i; - /* Generic loop variable. */ filestruct *firstline; /* The first line of the current paragraph. */ filestruct *sampleline; @@ -2290,7 +2288,7 @@ void do_justify(bool full_justify) /* Now tack all the lines of the paragraph together, skipping * the quoting and indentation on all lines after the first. */ - for (i = 0; i < par_len - 1; i++) { + while (par_len > 1) { filestruct *next_line = openfile->current->next; size_t line_len = strlen(openfile->current->data); size_t next_line_len = strlen(openfile->current->next->data); @@ -2328,11 +2326,6 @@ void do_justify(bool full_justify) openfile->edittop = openfile->current; unlink_node(next_line); - - /* If we've removed the next line, we need to go through - * this line again. */ - i--; - openfile->totsize--; par_len--; }