Commit 9e79ff77 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a4973d8f
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -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,6 +201,7 @@ int ui__question_window(const char *title, const char *text,
		SLsmg_write_string((char *)title);
	}
	SLsmg_gotorc(++y, x);
	if (exit_msg)
		nr_lines -= 2;
	max_len -= 2;
	SLsmg_write_wrapped_string((unsigned char *)text, y, x,
@@ -206,7 +209,12 @@ int ui__question_window(const char *title, const char *text,
	SLsmg_gotorc(y + nr_lines - 2, x);
	SLsmg_write_nstring((char *)" ", max_len);
	SLsmg_gotorc(y + nr_lines - 1, x);
	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);