tweaks: add calls of die() for five theoretical programming mistakes

master
Benno Schulenberg 2020-02-28 19:15:23 +01:00
parent a0aeeba075
commit e6f26464d7
2 changed files with 7 additions and 5 deletions

View File

@ -1484,7 +1484,8 @@ const char *flagtostr(int flag)
case LINE_NUMBERS: case LINE_NUMBERS:
return N_("Line numbering"); return N_("Line numbering");
default: default:
return "Bad toggle -- please report a bug"; die("Bad toggle -- please report a bug\n");
return "";
} }
} }
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */

View File

@ -282,7 +282,7 @@ void handle_indent_action(undostruct *u, bool undoing, bool add_indent)
linestruct *line = line_from_number(group->top_line); linestruct *line = line_from_number(group->top_line);
if (group->next != NULL) if (group->next != NULL)
statusline(ALERT, "Multiple groups -- please report a bug"); die("Multiple groups -- please report a bug\n");
/* When redoing, reposition the cursor and let the indenter adjust it. */ /* When redoing, reposition the cursor and let the indenter adjust it. */
if (!undoing) if (!undoing)
@ -1220,8 +1220,9 @@ void add_undo(undo_type action, const char *message)
case COMMENT: case COMMENT:
case UNCOMMENT: case UNCOMMENT:
#endif #endif
default:
break; break;
default:
die("Bad undo type -- please report a bug\n");
} }
openfile->last_action = action; openfile->last_action = action;
@ -1271,7 +1272,7 @@ void update_undo(undo_type action)
int charlen; int charlen;
if (u->type != action) if (u->type != action)
statusline(ALERT, "Mismatching undo type -- please report a bug"); die("Mismatching undo type -- please report a bug\n");
u->newsize = openfile->totsize; u->newsize = openfile->totsize;
@ -1360,7 +1361,7 @@ void update_undo(undo_type action)
u->head_x = openfile->current_x; u->head_x = openfile->current_x;
break; break;
default: default:
break; die("Bad undo type -- please report a bug\n");
} }
} }
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */