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.
This commit is contained in:
Benno Schulenberg 2019-05-24 19:13:26 +02:00
parent 98ffb19746
commit 35a791dee5

View File

@ -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;