diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-03-28 10:07:37 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-04-01 11:23:10 -0400 |
commit | a403253634141137e9a0585a6044e7c059c92f1b (patch) | |
tree | 08897ca8fdcb810717bd874003e5f58f773ad627 /tools | |
parent | 707ef2e69a53f2dc60cfa2ff5cb4bf5474206f33 (diff) |
perf map browser: Use ui_browser__input_window()
Instead of an ad-hoc, libnewt based equivalent.
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-elrijp95pijt66y6mmij4xm1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/ui/browsers/map.c | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/tools/perf/ui/browsers/map.c b/tools/perf/ui/browsers/map.c index 98851d55a53e..10b549c0eefb 100644 --- a/tools/perf/ui/browsers/map.c +++ b/tools/perf/ui/browsers/map.c | |||
@@ -1,6 +1,5 @@ | |||
1 | #include "../libslang.h" | 1 | #include "../libslang.h" |
2 | #include <elf.h> | 2 | #include <elf.h> |
3 | #include <newt.h> | ||
4 | #include <inttypes.h> | 3 | #include <inttypes.h> |
5 | #include <sys/ttydefaults.h> | 4 | #include <sys/ttydefaults.h> |
6 | #include <string.h> | 5 | #include <string.h> |
@@ -10,41 +9,9 @@ | |||
10 | #include "../../util/symbol.h" | 9 | #include "../../util/symbol.h" |
11 | #include "../browser.h" | 10 | #include "../browser.h" |
12 | #include "../helpline.h" | 11 | #include "../helpline.h" |
12 | #include "../keysyms.h" | ||
13 | #include "map.h" | 13 | #include "map.h" |
14 | 14 | ||
15 | static int ui_entry__read(const char *title, char *bf, size_t size, int width) | ||
16 | { | ||
17 | struct newtExitStruct es; | ||
18 | newtComponent form, entry; | ||
19 | const char *result; | ||
20 | int err = -1; | ||
21 | |||
22 | newtCenteredWindow(width, 1, title); | ||
23 | form = newtForm(NULL, NULL, 0); | ||
24 | if (form == NULL) | ||
25 | return -1; | ||
26 | |||
27 | entry = newtEntry(0, 0, "0x", width, &result, NEWT_FLAG_SCROLL); | ||
28 | if (entry == NULL) | ||
29 | goto out_free_form; | ||
30 | |||
31 | newtFormAddComponent(form, entry); | ||
32 | newtFormAddHotKey(form, NEWT_KEY_ENTER); | ||
33 | newtFormAddHotKey(form, NEWT_KEY_ESCAPE); | ||
34 | newtFormAddHotKey(form, NEWT_KEY_LEFT); | ||
35 | newtFormAddHotKey(form, CTRL('c')); | ||
36 | newtFormRun(form, &es); | ||
37 | |||
38 | if (result != NULL) { | ||
39 | strncpy(bf, result, size); | ||
40 | err = 0; | ||
41 | } | ||
42 | out_free_form: | ||
43 | newtPopWindow(); | ||
44 | newtFormDestroy(form); | ||
45 | return err; | ||
46 | } | ||
47 | |||
48 | struct map_browser { | 15 | struct map_browser { |
49 | struct ui_browser b; | 16 | struct ui_browser b; |
50 | struct map *map; | 17 | struct map *map; |
@@ -78,10 +45,11 @@ static int map_browser__search(struct map_browser *self) | |||
78 | { | 45 | { |
79 | char target[512]; | 46 | char target[512]; |
80 | struct symbol *sym; | 47 | struct symbol *sym; |
81 | int err = ui_entry__read("Search by name/addr", target, sizeof(target), 40); | 48 | int err = ui_browser__input_window("Search by name/addr", |
82 | 49 | "Prefix with 0x to search by address", | |
83 | if (err) | 50 | target, "ENTER: OK, ESC: Cancel", 0); |
84 | return err; | 51 | if (err != K_ENTER) |
52 | return -1; | ||
85 | 53 | ||
86 | if (target[0] == '0' && tolower(target[1]) == 'x') { | 54 | if (target[0] == '0' && tolower(target[1]) == 'x') { |
87 | u64 addr = strtoull(target, NULL, 16); | 55 | u64 addr = strtoull(target, NULL, 16); |