From 50743a7fed464958aba9f729324e35a4f0c945a3 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 13 Jun 2013 17:38:26 +0200 Subject: flowtop: Remove unnecessary bug_on() and rework presenter_screen_init() The screen pointer can never be NULL, since initscr() exits the process in case of an error. Thus the bug_on() check can be omitted. Also rework presenter_screen_init() - where initscr() is called - to return the pointer. This will also silence a Coverity scanner error (even though it isn't actually one). Signed-off-by: Tobias Klauser --- flowtop.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'flowtop.c') diff --git a/flowtop.c b/flowtop.c index a21ff34..87bcbc2 100644 --- a/flowtop.c +++ b/flowtop.c @@ -740,15 +740,18 @@ static uint16_t presenter_get_port(uint16_t src, uint16_t dst, int tcp) } } -static void presenter_screen_init(WINDOW **screen) +static WINDOW *presenter_screen_init(void) { - (*screen) = initscr(); + WINDOW *screen = initscr(); + noecho(); cbreak(); keypad(stdscr, TRUE); - nodelay(*screen, TRUE); + nodelay(screen, TRUE); refresh(); - wrefresh(*screen); + wrefresh(screen); + + return screen; } static void presenter_screen_do_line(WINDOW *screen, struct flow_entry *n, @@ -917,8 +920,6 @@ static void presenter_screen_update(WINDOW *screen, struct flow_list *fl, [IPPROTO_ICMPV6] = 1, }; - bug_on(screen == NULL); - curs_set(0); maxy = getmaxy(screen); @@ -994,10 +995,10 @@ static inline void presenter_screen_end(void) static void presenter(void) { int skip_lines = 0; - WINDOW *screen = NULL; + WINDOW *screen; dissector_init_ethernet(0); - presenter_screen_init(&screen); + screen = presenter_screen_init(); rcu_register_thread(); while (!sigint) { -- cgit v1.2.3-54-g00ecf