nano

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

commit 35a791dee5e9d7918507c57fe6862e5d21ef4add
parent 98ffb197466e983aeb984bd176feff3d08cd4cb1
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 24 May 2019 19:13:26 +0200

tweaks: remove two unneeded checks for NULL

If the rest of nano is correct, then these checks are superfluous and
only slow the loops down.  But if there is some incorrect code, then
let nano crash on dereferencing NULL so we can find and fix the bug.

Diffstat:
Msrc/utils.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/utils.c b/src/utils.c @@ -501,10 +501,10 @@ linestruct *line_from_number(ssize_t lineno) linestruct *f = openfile->current; if (lineno <= openfile->current->lineno) - while (f->lineno != lineno && f->prev != NULL) + while (f->lineno != lineno) f = f->prev; else - while (f->lineno != lineno && f->next != NULL) + while (f->lineno != lineno) f = f->next; return f;