diff --git a/configure.ac b/configure.ac index 49ec2246..ed5c1fe1 100644 --- a/configure.ac +++ b/configure.ac @@ -42,7 +42,7 @@ PKG_CHECK_MODULES([DEPS], [openssl glib-2.0 libcurl]) PKG_CHECK_MODULES([NOTIFY], [libnotify], [], [AC_MSG_NOTICE([libnotify module not found])]) -AM_CFLAGS="-O3 " +AM_CFLAGS="-O3 -Wall" AM_CFLAGS="$AM_CFLAGS -lstrophe -lxml2 -lexpat -lncurses -lcurl -lresolv " AM_CFLAGS="$AM_CFLAGS $DEPS_LIBS $NOTIFY_LIBS" diff --git a/src/input_win.c b/src/input_win.c index 6f553b42..be030f29 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -81,9 +81,9 @@ create_input_window(void) void inp_win_resize(const char * const input, const int size) { - int rows, cols, inp_x, inp_y; + int rows, cols, inp_x; getmaxyx(stdscr, rows, cols); - getyx(inp_win, inp_y, inp_x); + inp_x = getcurx(inp_win); // if lost cursor off screen, move contents to show it if (inp_x >= pad_start + cols) { diff --git a/src/prof_history.c b/src/prof_history.c index c9139c57..e5667d86 100644 --- a/src/prof_history.c +++ b/src/prof_history.c @@ -124,7 +124,7 @@ p_history_previous(PHistory history, char *item) _create_session(history); // add the new item - g_list_append(history->session.items, copied); + history->session.items = g_list_append(history->session.items, copied); history->session.sess_new = g_list_last(history->session.items); char *result = strdup(history->session.sess_curr->data); diff --git a/src/status_bar.c b/src/status_bar.c index 763f5ada..3a22d3db 100644 --- a/src/status_bar.c +++ b/src/status_bar.c @@ -122,8 +122,7 @@ status_bar_inactive(const int win) int active_pos = 1 + ((win -1) * 3); - int rows, cols; - getmaxyx(stdscr, rows, cols); + int cols = getmaxx(stdscr); mvwaddch(status_bar, 0, cols - 29 + active_pos, ' '); if (win == 9) @@ -140,8 +139,7 @@ status_bar_active(const int win) int active_pos = 1 + ((win -1) * 3); - int rows, cols; - getmaxyx(stdscr, rows, cols); + int cols = getmaxx(stdscr); wattron(status_bar, COLOUR_BAR_DRAW); if (win < 9) @@ -161,8 +159,7 @@ status_bar_new(const int win) int active_pos = 1 + ((win -1) * 3); - int rows, cols; - getmaxyx(stdscr, rows, cols); + int cols = getmaxx(stdscr); wattron(status_bar, COLOUR_BAR_TEXT); wattron(status_bar, A_BLINK); @@ -212,8 +209,8 @@ status_bar_clear(void) wclear(status_bar); - int rows, cols; - getmaxyx(stdscr, rows, cols); + int cols = getmaxx(stdscr); + wattron(status_bar, COLOUR_BAR_DRAW); mvwprintw(status_bar, 0, cols - 29, _active); wattroff(status_bar, COLOUR_BAR_DRAW); diff --git a/src/tinyurl.c b/src/tinyurl.c index 60ced9a1..48987cf3 100644 --- a/src/tinyurl.c +++ b/src/tinyurl.c @@ -49,7 +49,6 @@ tinyurl_get(char *url) g_string_append(full_url, url); CURL *handle = curl_easy_init(); - CURLcode result; struct curl_data_t output; output.buffer = NULL; output.size = 0; @@ -58,7 +57,7 @@ tinyurl_get(char *url) curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, _data_callback); curl_easy_setopt(handle, CURLOPT_WRITEDATA, (void *)&output); - result = curl_easy_perform(handle); + curl_easy_perform(handle); curl_easy_cleanup(handle); output.buffer[output.size++] = '\0'; diff --git a/src/title_bar.c b/src/title_bar.c index 17187f17..2e067d59 100644 --- a/src/title_bar.c +++ b/src/title_bar.c @@ -39,8 +39,7 @@ static void _title_bar_draw_status(void); void create_title_bar(void) { - int rows, cols; - getmaxyx(stdscr, rows, cols); + int cols = getmaxx(stdscr); title_bar = newwin(1, cols, 0, 0); wbkgd(title_bar, COLOUR_BAR_DEF); @@ -61,8 +60,7 @@ title_bar_title(void) void title_bar_resize(void) { - int rows, cols; - getmaxyx(stdscr, rows, cols); + int cols = getmaxx(stdscr); wresize(title_bar, 1, cols); wbkgd(title_bar, COLOUR_BAR_DEF); @@ -173,8 +171,7 @@ title_bar_draw(void) static void _title_bar_draw_status(void) { - int rows, cols; - getmaxyx(stdscr, rows, cols); + int cols = getmaxx(stdscr); wattron(title_bar, COLOUR_BAR_DRAW); mvwaddch(title_bar, 0, cols - 14, '['); diff --git a/src/windows.c b/src/windows.c index e4bed428..a57bf3f7 100644 --- a/src/windows.c +++ b/src/windows.c @@ -619,12 +619,10 @@ win_handle_special_keys(const int * const ch) void win_page_off(void) { - int rows, cols; - getmaxyx(stdscr, rows, cols); + int rows = getmaxy(stdscr); _wins[_curr_prof_win].paged = 0; - int y, x; - getyx(_wins[_curr_prof_win].win, y, x); + int y = getcury(_wins[_curr_prof_win].win); int size = rows - 3; @@ -947,9 +945,8 @@ _win_handle_switch(const int * const ch) static void _win_handle_page(const int * const ch) { - int rows, cols, y, x; - getmaxyx(stdscr, rows, cols); - getyx(_wins[_curr_prof_win].win, y, x); + int rows = getmaxy(stdscr); + int y = getcury(_wins[_curr_prof_win].win); int page_space = rows - 4; int *page_start = &_wins[_curr_prof_win].y_pos;