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.
This commit is contained in:
10
src/text.c
10
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:
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user