From a7b8436818c454823853eef0a21d8d1be5667ee3 Mon Sep 17 00:00:00 2001 From: Andreas Heil Date: Tue, 23 May 2023 10:12:00 +0200 Subject: [PATCH] fix remove unused variables and uset getmaxx() or getmaxy() for remaining variables --- src/curses/ui_call_flow.c | 22 +++++----------------- src/curses/ui_call_list.c | 7 +------ src/curses/ui_manager.c | 7 ++----- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/curses/ui_call_flow.c b/src/curses/ui_call_flow.c index 1a8d51a..974fcdb 100644 --- a/src/curses/ui_call_flow.c +++ b/src/curses/ui_call_flow.c @@ -428,7 +428,7 @@ call_flow_draw_message(ui_t *ui, call_flow_arrow_t *arrow, int cline) address_t dst; char method[METHOD_MAXLEN + 1]; char delta[15] = {}; - int flowh, floww; + int flowh; char mediastr[40]; sip_msg_t *msg = arrow->item; vector_iter_t medias; @@ -436,9 +436,6 @@ call_flow_draw_message(ui_t *ui, call_flow_arrow_t *arrow, int cline) int msglen; int aline = cline + 1; - // quell warning about unused variables (getmaxyx is a macro) - (void)floww; - // Initialize method memset(method, 0, sizeof(method)); @@ -447,7 +444,7 @@ call_flow_draw_message(ui_t *ui, call_flow_arrow_t *arrow, int cline) // Get the messages window flow_win = info->flow_win; - getmaxyx(flow_win, flowh, floww); + flowh = getmaxx(flow_win); // Store arrow start line arrow->line = cline; @@ -676,21 +673,18 @@ call_flow_draw_rtp_stream(ui_t *ui, call_flow_arrow_t *arrow, int cline) call_flow_info_t *info; WINDOW *win; char text[50], time[20]; - int height, width; + int height; rtp_stream_t *stream = arrow->item; sip_msg_t *msg; sip_call_t *call; call_flow_arrow_t *msgarrow; address_t addr; - // quell warning about unused variables (getmaxyx is a macro) - (void)width; - // Get panel information info = call_flow_info(ui); // Get the messages window win = info->flow_win; - getmaxyx(win, height, width); + height = getmaxy(win); // Store arrow start line arrow->line = cline; @@ -1113,23 +1107,17 @@ call_flow_draw_raw_rtcp(ui_t *ui, rtp_stream_t *stream) int call_flow_handle_key(ui_t *ui, int key) { - int raw_width, height, width; + int raw_width; call_flow_info_t *info = call_flow_info(ui); ui_t *next_ui; sip_call_t *call = NULL, *xcall = NULL; int rnpag_steps = setting_get_intvalue(SETTING_CF_SCROLLSTEP); int action = -1; - // quell warnings about unused variables (getmaxyx is a macro) - (void)height; - (void)width; - // Sanity check, this should not happen if (!info) return KEY_NOT_HANDLED; - getmaxyx(info->flow_win, height, width); - // Check actions for this key while ((action = key_find_action(key, action)) != ERR) { // Check if we handle this action diff --git a/src/curses/ui_call_list.c b/src/curses/ui_call_list.c index c6682ba..ec686e6 100644 --- a/src/curses/ui_call_list.c +++ b/src/curses/ui_call_list.c @@ -558,7 +558,7 @@ call_list_line_text(ui_t *ui, sip_call_t *call, char *text) int call_list_handle_key(ui_t *ui, int key) { - int listh, listw,rnpag_steps = setting_get_intvalue(SETTING_CL_SCROLLSTEP); + int rnpag_steps = setting_get_intvalue(SETTING_CL_SCROLLSTEP); call_list_info_t *info; ui_t *next_ui; sip_call_group_t *group; @@ -566,10 +566,6 @@ call_list_handle_key(ui_t *ui, int key) sip_call_t *call, *xcall; sip_sort_t sort; - // quell warnings about unused variables (getmaxyx is a macro) - (void)listh; - (void)listw; - // Sanity check, this should not happen if (!(info = call_list_info(ui))) return -1; @@ -583,7 +579,6 @@ call_list_handle_key(ui_t *ui, int key) // Get window of call list panel WINDOW *list_win = info->list_win; - getmaxyx(list_win, listh, listw); // Check actions for this key while ((action = key_find_action(key, action)) != ERR) { diff --git a/src/curses/ui_manager.c b/src/curses/ui_manager.c index dd02a8a..f01ebc4 100644 --- a/src/curses/ui_manager.c +++ b/src/curses/ui_manager.c @@ -592,12 +592,9 @@ dialog_progress_run(const char *fmt, ...) void dialog_progress_set_value(WINDOW *win, int perc) { - int height, width; + int width; - // quell warning about unused variables (getmaxyx is a macro) - (void)height; - - getmaxyx(win, height, width); + width = getmaxx(win); mvwhline(win, 4, 4, '-', width - 10); mvwaddch(win, 4, 3, '['); mvwaddch(win, 4, width - 7, ']');