From patchwork Wed Jun 15 13:50:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1944 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id F194C23DE6 for ; Wed, 15 Jun 2011 13:52:49 +0000 (UTC) Received: from mail-vx0-f180.google.com (mail-vx0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id BFEB6A180BB for ; Wed, 15 Jun 2011 13:52:49 +0000 (UTC) Received: by mail-vx0-f180.google.com with SMTP id 12so410262vxk.11 for ; Wed, 15 Jun 2011 06:52:49 -0700 (PDT) Received: by 10.52.95.194 with SMTP id dm2mr535925vdb.47.1308145969304; Wed, 15 Jun 2011 06:52:49 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.52.183.130 with SMTP id em2cs126651vdc; Wed, 15 Jun 2011 06:52:49 -0700 (PDT) Received: by 10.14.20.1 with SMTP id o1mr292589eeo.63.1308145967414; Wed, 15 Jun 2011 06:52:47 -0700 (PDT) Received: from smtp.smtpout.orange.fr (smtp05.smtpout.orange.fr [80.12.242.127]) by mx.google.com with ESMTP id z42si1390584weq.75.2011.06.15.06.52.46; Wed, 15 Jun 2011 06:52:47 -0700 (PDT) Received-SPF: neutral (google.com: 80.12.242.127 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=80.12.242.127; Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.127 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: from monster.dhcp.lxc ([92.134.76.78]) by mwinf5d28 with ME id wDsa1g00D1hMfSL03DsmEo; Wed, 15 Jun 2011 15:52:46 +0200 From: Daniel Lezcano To: daniel.lezcano@linaro.org Cc: linaro-dev@lists.linaro.org, patches@linaro.org Subject: [powerdebug 22/22] make some display functions static Date: Wed, 15 Jun 2011 15:50:56 +0200 Message-Id: <1308145856-6112-22-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1308145856-6112-1-git-send-email-daniel.lezcano@linaro.org> References: <1308145856-6112-1-git-send-email-daniel.lezcano@linaro.org> Make some functions static as they are no longer out of the scope of the display code. Signed-off-by: Daniel Lezcano --- display.c | 124 ++++++++++++++++++++++++++++++------------------------------ 1 files changed, 62 insertions(+), 62 deletions(-) diff --git a/display.c b/display.c index 1ba71e5..257e540 100644 --- a/display.c +++ b/display.c @@ -234,7 +234,27 @@ int display_refresh(void) return 0; } -int display_select(void) +int display_refresh_pad(int win) +{ + return prefresh(windata[win].pad, windata[win].scrolling, + 0, 2, 0, maxy - 2, maxx); +} + +static int display_show_unselection(int win, int line, bool bold) +{ + if (mvwchgat(windata[win].pad, line, 0, -1, + bold ? WA_BOLD: WA_NORMAL, 0, NULL) < 0) + return -1; + + return display_refresh_pad(win); +} + +void *display_get_row_data(int win) +{ + return windata[win].rowdata[windata[win].cursor].data; +} + +static int display_select(void) { if (windata[current_win].ops && windata[current_win].ops->select) return windata[current_win].ops->select(); @@ -242,7 +262,7 @@ int display_select(void) return 0; } -int display_next_panel(void) +static int display_next_panel(void) { size_t array_size = sizeof(windata) / sizeof(windata[0]); @@ -252,7 +272,7 @@ int display_next_panel(void) return current_win; } -int display_prev_panel(void) +static int display_prev_panel(void) { size_t array_size = sizeof(windata) / sizeof(windata[0]); @@ -263,27 +283,53 @@ int display_prev_panel(void) return current_win; } -int display_refresh_pad(int win) +static int display_next_line(void) { - return prefresh(windata[win].pad, windata[win].scrolling, - 0, 2, 0, maxy - 2, maxx); -} + 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; -int display_show_unselection(int win, int line, bool bold) -{ - if (mvwchgat(windata[win].pad, line, 0, -1, - bold ? WA_BOLD: WA_NORMAL, 0, NULL) < 0) - return -1; + if (cursor >= nrdata) + return cursor; - return display_refresh_pad(win); + display_show_unselection(current_win, cursor, rowdata[cursor].attr); + if (cursor < nrdata - 1) { + if (cursor >= (maxy - 4 + scrolling)) + scrolling++; + cursor++; + } + + windata[current_win].scrolling = scrolling; + windata[current_win].cursor = cursor; + + return cursor; } -void *display_get_row_data(int win) +static int display_prev_line(void) { - return windata[win].rowdata[windata[win].cursor].data; + 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; + + if (cursor >= nrdata) + return cursor; + + display_show_unselection(current_win, cursor, rowdata[cursor].attr); + if (cursor > 0) { + if (cursor <= scrolling) + scrolling--; + cursor--; + } + + windata[current_win].scrolling = scrolling; + windata[current_win].cursor = cursor; + + return cursor; } -int display_set_row_data(int win, int line, void *data, int attr) +static int display_set_row_data(int win, int line, void *data, int attr) { struct rowdata *rowdata = windata[win].rowdata; @@ -332,52 +378,6 @@ int display_print_line(int win, int line, char *str, int bold, void *data) return 0; } -int display_next_line(void) -{ - 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; - - if (cursor >= nrdata) - return cursor; - - display_show_unselection(current_win, cursor, rowdata[cursor].attr); - if (cursor < nrdata - 1) { - if (cursor >= (maxy - 4 + scrolling)) - scrolling++; - cursor++; - } - - windata[current_win].scrolling = scrolling; - windata[current_win].cursor = cursor; - - return cursor; -} - -int display_prev_line(void) -{ - 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; - - if (cursor >= nrdata) - return cursor; - - display_show_unselection(current_win, cursor, rowdata[cursor].attr); - if (cursor > 0) { - if (cursor <= scrolling) - scrolling--; - cursor--; - } - - windata[current_win].scrolling = scrolling; - windata[current_win].cursor = cursor; - - return cursor; -} - int display_keystroke(void *data) { int *tick = data;