nano

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

commit 98ffb197466e983aeb984bd176feff3d08cd4cb1
parent 93edd12099c5b94c904ce0d6d4f244e6f9c78c18
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 24 May 2019 19:02:14 +0200

tweaks: stop checking for a NULL result from line_from_number()

No one ever reported seeing the message that was removed in commit
c039aaad one month ago, so most likely the code is correct and nano
never calls line_from_number() with a non-existent line number.

Diffstat:
Msrc/text.c | 10++--------
Msrc/utils.c | 5+----
2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -523,11 +523,8 @@ void do_undo(void) return; } - if (u->type <= REPLACE) { + if (u->type <= REPLACE) f = line_from_number(u->mark_begin_lineno); - if (f == NULL) - return; - } openfile->current_x = u->begin; switch (u->type) { @@ -695,11 +692,8 @@ void do_redo(void) while (u->next != openfile->current_undo) u = u->next; - if (u->type <= REPLACE) { + if (u->type <= REPLACE) f = line_from_number(u->mark_begin_lineno); - if (f == NULL) - return; - } switch (u->type) { case ADD: diff --git a/src/utils.c b/src/utils.c @@ -507,10 +507,7 @@ linestruct *line_from_number(ssize_t lineno) while (f->lineno != lineno && f->next != NULL) f = f->next; - if (f->lineno == lineno) - return f; - else - return NULL; + return f; } #endif /* !NANO_TINY */