tweaks: remove two redundant case labels

The add_undo() and update_undo() functions are never called with
JOIN as argument, so there is no need to have a case label for it.
master
Benno Schulenberg 2020-02-28 19:05:09 +01:00
parent c640a55b1c
commit a0aeeba075
1 changed files with 3 additions and 7 deletions

View File

@ -1142,8 +1142,8 @@ void add_undo(undo_type action, const char *message)
u->xflags |= WAS_FINAL_BACKSPACE; u->xflags |= WAS_FINAL_BACKSPACE;
/* Fall-through. */ /* Fall-through. */
case DEL: case DEL:
/* When not at the end of a line, store the deleted character, /* When not at the end of a line, store the deleted character;
* else purposely fall into the line-joining code. */ * otherwise, morph the undo item into a line join. */
if (openfile->current->data[openfile->current_x] != '\0') { if (openfile->current->data[openfile->current_x] != '\0') {
char *char_buf = charalloc(MAXCHARLEN + 1); char *char_buf = charalloc(MAXCHARLEN + 1);
int charlen = collect_char(&openfile->current->data[u->head_x], int charlen = collect_char(&openfile->current->data[u->head_x],
@ -1154,8 +1154,7 @@ void add_undo(undo_type action, const char *message)
u->tail_x += charlen; u->tail_x += charlen;
break; break;
} }
/* Fall-through. */ action = JOIN;
case JOIN:
if (openfile->current->next != NULL) { if (openfile->current->next != NULL) {
if (u->type == BACK) { if (u->type == BACK) {
u->head_lineno = openfile->current->next->lineno; u->head_lineno = openfile->current->next->lineno;
@ -1164,7 +1163,6 @@ void add_undo(undo_type action, const char *message)
u->strdata = copy_of(openfile->current->next->data); u->strdata = copy_of(openfile->current->next->data);
} }
u->type = JOIN; u->type = JOIN;
action = JOIN;
break; break;
case REPLACE: case REPLACE:
u->strdata = copy_of(openfile->current->data); u->strdata = copy_of(openfile->current->data);
@ -1311,8 +1309,6 @@ void update_undo(undo_type action)
/* They deleted *elsewhere* on the line: start a new undo item. */ /* They deleted *elsewhere* on the line: start a new undo item. */
add_undo(u->type, NULL); add_undo(u->type, NULL);
break; break;
case JOIN:
break;
case REPLACE: case REPLACE:
break; break;
#ifdef ENABLE_WRAPPING #ifdef ENABLE_WRAPPING