aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-21 00:57:08 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-21 00:57:08 +0200
commit0a8cc5880b9ba3fa8ef257329017f9d6d81e35b5 (patch)
tree28ebe181aa3c73374a5b931b768ec5b101fdde93
parentc757e6d3e7ab7687610b383f0262b02481ca7fc6 (diff)
downloadpowerdebug-0a8cc5880b9ba3fa8ef257329017f9d6d81e35b5.tar.gz
remove maxx and maxy global variables
The maxx and maxy variables are already global functions defined in the ncurses library. They are accessible through the getmaxyx macro. Is it not needed to add two more global variables to our code, let's use the code ncurses gives to us. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--display.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/display.c b/display.c
index 1af12a3..bd5971a 100644
--- a/display.c
+++ b/display.c
@@ -37,8 +37,6 @@ static WINDOW *footer_win;
static WINDOW *main_win;
static int current_win;
-int maxx, maxy;
-
/* Number of lines in the virtual window */
static const int maxrows = 1024;
@@ -119,6 +117,10 @@ int display_refresh(int win)
int display_refresh_pad(int win)
{
+ int maxx, maxy;
+
+ getmaxyx(stdscr, maxy, maxx);
+
return prefresh(windata[win].pad, windata[win].scrolling,
0, 2, 0, maxy - 2, maxx);
}
@@ -168,11 +170,14 @@ static int display_prev_panel(void)
static int display_next_line(void)
{
+ int maxx, maxy;
int cursor = windata[current_win].cursor;
int nrdata = windata[current_win].nrdata;
int scrolling = windata[current_win].scrolling;
struct rowdata *rowdata = windata[current_win].rowdata;
+ getmaxyx(stdscr, maxy, maxx);
+
if (cursor >= nrdata)
return cursor;
@@ -309,7 +314,7 @@ static int display_keystroke(int fd, void *data)
int display_init(int wdefault)
{
- int i;
+ int i, maxx, maxy;
size_t array_size = sizeof(windata) / sizeof(windata[0]);
current_win = wdefault;