mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
perf map browser: Use ui_browser__input_window()
Instead of an ad-hoc, libnewt based equivalent. Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
707ef2e69a
commit
a403253634
1 changed files with 6 additions and 38 deletions
|
|
@ -1,6 +1,5 @@
|
|||
#include "../libslang.h"
|
||||
#include <elf.h>
|
||||
#include <newt.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/ttydefaults.h>
|
||||
#include <string.h>
|
||||
|
|
@ -10,41 +9,9 @@
|
|||
#include "../../util/symbol.h"
|
||||
#include "../browser.h"
|
||||
#include "../helpline.h"
|
||||
#include "../keysyms.h"
|
||||
#include "map.h"
|
||||
|
||||
static int ui_entry__read(const char *title, char *bf, size_t size, int width)
|
||||
{
|
||||
struct newtExitStruct es;
|
||||
newtComponent form, entry;
|
||||
const char *result;
|
||||
int err = -1;
|
||||
|
||||
newtCenteredWindow(width, 1, title);
|
||||
form = newtForm(NULL, NULL, 0);
|
||||
if (form == NULL)
|
||||
return -1;
|
||||
|
||||
entry = newtEntry(0, 0, "0x", width, &result, NEWT_FLAG_SCROLL);
|
||||
if (entry == NULL)
|
||||
goto out_free_form;
|
||||
|
||||
newtFormAddComponent(form, entry);
|
||||
newtFormAddHotKey(form, NEWT_KEY_ENTER);
|
||||
newtFormAddHotKey(form, NEWT_KEY_ESCAPE);
|
||||
newtFormAddHotKey(form, NEWT_KEY_LEFT);
|
||||
newtFormAddHotKey(form, CTRL('c'));
|
||||
newtFormRun(form, &es);
|
||||
|
||||
if (result != NULL) {
|
||||
strncpy(bf, result, size);
|
||||
err = 0;
|
||||
}
|
||||
out_free_form:
|
||||
newtPopWindow();
|
||||
newtFormDestroy(form);
|
||||
return err;
|
||||
}
|
||||
|
||||
struct map_browser {
|
||||
struct ui_browser b;
|
||||
struct map *map;
|
||||
|
|
@ -78,10 +45,11 @@ static int map_browser__search(struct map_browser *self)
|
|||
{
|
||||
char target[512];
|
||||
struct symbol *sym;
|
||||
int err = ui_entry__read("Search by name/addr", target, sizeof(target), 40);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
int err = ui_browser__input_window("Search by name/addr",
|
||||
"Prefix with 0x to search by address",
|
||||
target, "ENTER: OK, ESC: Cancel", 0);
|
||||
if (err != K_ENTER)
|
||||
return -1;
|
||||
|
||||
if (target[0] == '0' && tolower(target[1]) == 'x') {
|
||||
u64 addr = strtoull(target, NULL, 16);
|
||||
|
|
|
|||
Loading…
Reference in a new issue