aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/tui/util.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-08-19 16:09:50 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-08-20 12:21:27 -0300
commit9e79ff77e4195e40e7a47a2001132db66e25d541 (patch)
tree8793884ebfd9feeaec0d44b4a80cc045b28e58e5 /tools/perf/ui/tui/util.c
parentperf cs-etm: Support sample flags 'insn' and 'insnlen' (diff)
downloadlinux-dev-9e79ff77e4195e40e7a47a2001132db66e25d541.tar.xz
linux-dev-9e79ff77e4195e40e7a47a2001132db66e25d541.zip
perf ui: Make 'exit_msg' optional in ui__question_window()
We will not need it when refactoring this function to be non-interactive, so make it optional. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-pnx1dn17bsz7lqt9ty95nnjx@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/tui/util.c')
-rw-r--r--tools/perf/ui/tui/util.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/perf/ui/tui/util.c b/tools/perf/ui/tui/util.c
index fe5e571816fc..5d65ea8b6496 100644
--- a/tools/perf/ui/tui/util.c
+++ b/tools/perf/ui/tui/util.c
@@ -188,7 +188,9 @@ int ui__question_window(const char *title, const char *text,
pthread_mutex_lock(&ui__lock);
max_len += 2;
- nr_lines += 4;
+ nr_lines += 2;
+ if (exit_msg)
+ nr_lines += 2;
y = SLtt_Screen_Rows / 2 - nr_lines / 2,
x = SLtt_Screen_Cols / 2 - max_len / 2;
@@ -199,14 +201,20 @@ int ui__question_window(const char *title, const char *text,
SLsmg_write_string((char *)title);
}
SLsmg_gotorc(++y, x);
- nr_lines -= 2;
+ if (exit_msg)
+ nr_lines -= 2;
max_len -= 2;
SLsmg_write_wrapped_string((unsigned char *)text, y, x,
nr_lines, max_len, 1);
SLsmg_gotorc(y + nr_lines - 2, x);
SLsmg_write_nstring((char *)" ", max_len);
SLsmg_gotorc(y + nr_lines - 1, x);
- SLsmg_write_nstring((char *)exit_msg, max_len);
+ if (exit_msg) {
+ SLsmg_gotorc(y + nr_lines - 2, x);
+ SLsmg_write_nstring((char *)" ", max_len);
+ SLsmg_gotorc(y + nr_lines - 1, x);
+ SLsmg_write_nstring((char *)exit_msg, max_len);
+ }
SLsmg_refresh();
pthread_mutex_unlock(&ui__lock);