Skip to content

Commit

Permalink
Fix warnings found by static analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Nov 8, 2015
1 parent 3435cf0 commit 024e456
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ui-curses.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ static void ui_window_draw(UiWin *w) {
}
short selection_bg = win->styles[UI_STYLE_SELECTION].bg;
short cursor_line_bg = win->styles[UI_STYLE_CURSOR_LINE].bg;
attr_t attr;
attr_t attr = A_NORMAL;
for (const Line *l = view_lines_get(win->view); l; l = l->next) {
bool cursor_line = l->lineno == cursor_lineno;
for (int x = 0; x < width; x++) {
Expand Down Expand Up @@ -919,7 +919,7 @@ static UiWin *ui_window_new(Ui *ui, View *view, File *file) {
return &win->uiwin;
}

static void ui_die(Ui *ui, const char *msg, va_list ap) {
__attribute__((noreturn)) static void ui_die(Ui *ui, const char *msg, va_list ap) {
UiCurses *uic = (UiCurses*)ui;
endwin();
if (uic->termkey)
Expand Down
2 changes: 1 addition & 1 deletion ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct Ui {
void (*prompt)(Ui*, const char *title, const char *value);
char* (*prompt_input)(Ui*);
void (*prompt_hide)(Ui*);
void (*die)(Ui*, const char *msg, va_list ap);
void (*die)(Ui*, const char *msg, va_list ap) __attribute__((noreturn));
void (*info)(Ui*, const char *msg, va_list ap);
void (*info_hide)(Ui*);
void (*arrange)(Ui*, enum UiLayout);
Expand Down
3 changes: 1 addition & 2 deletions view.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,7 @@ bool view_resize(View *view, int width, int height) {
}
view->width = width;
view->height = height;
if (view->lines)
memset(view->lines, 0, view->lines_size);
memset(view->lines, 0, view->lines_size);
view_draw(view);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion vis.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int vis_run(Vis*, int argc, char *argv[]);
/* terminate editing session, given status will be the return value of vis_run */
void vis_exit(Vis*, int status);
/* emergency exit, print given message, perform minimal ui cleanup and exit process */
void vis_die(Vis*, const char *msg, ...);
void vis_die(Vis*, const char *msg, ...) __attribute__((noreturn));

/* user facing modes are: NORMAL, VISUAL, VISUAL_LINE, PROMPT, INSERT, REPLACE.
* the others should be considered as implementation details (TODO: do not expose them?) */
Expand Down

0 comments on commit 024e456

Please sign in to comment.