diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-11-08 17:10:47 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-11-08 19:40:29 +0100 |
| commit | 024e456ddadd67f212d84665501869c568a106fb (patch) | |
| tree | 1fbc32e0c155cc2c656eae17c2188ed480e54f90 | |
| parent | 3435cf05fb063d92e1cfa3cd7ccb71ae5f792411 (diff) | |
| download | vis-024e456ddadd67f212d84665501869c568a106fb.tar.gz vis-024e456ddadd67f212d84665501869c568a106fb.tar.xz | |
Fix warnings found by static analyzer
| -rw-r--r-- | ui-curses.c | 4 | ||||
| -rw-r--r-- | ui.h | 2 | ||||
| -rw-r--r-- | view.c | 3 | ||||
| -rw-r--r-- | vis.h | 2 |
4 files changed, 5 insertions, 6 deletions
diff --git a/ui-curses.c b/ui-curses.c index 7e30dbc..ef397c0 100644 --- a/ui-curses.c +++ b/ui-curses.c @@ -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++) { @@ -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) @@ -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); @@ -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; } @@ -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?) */ |
