As David suggested, this patch has no functional changes just a code move. move prompt_integer() from tools/perf/builtin-top.c into tools/perf/util/top.c
Signed-off-by: Runzhen Wang <[email protected]> Signed-off-by: David Ahern <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Xiao Guangrong <[email protected]> --- tools/perf/builtin-top.c | 26 -------------------------- tools/perf/util/top.c | 26 ++++++++++++++++++++++++++ tools/perf/util/top.h | 1 + 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 495171a..cb7c308 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -298,32 +298,6 @@ static void perf_top__print_sym_table(struct perf_top *top) top->min_percent, stdout); } -static void prompt_integer(int *target, const char *msg) -{ - char *buf = malloc(0), *p; - size_t dummy = 0; - int tmp; - - fprintf(stdout, "\n%s: ", msg); - if (getline(&buf, &dummy, stdin) < 0) - return; - - p = strchr(buf, '\n'); - if (p) - *p = 0; - - p = buf; - while(*p) { - if (!isdigit(*p)) - goto out_free; - p++; - } - tmp = strtoul(buf, NULL, 10); - *target = tmp; -out_free: - free(buf); -} - static void prompt_percent(int *target, const char *msg) { int tmp = 0; diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c index f857b51..1a2eaec 100644 --- a/tools/perf/util/top.c +++ b/tools/perf/util/top.c @@ -115,3 +115,29 @@ void perf_top__reset_sample_counters(struct perf_top *top) top->exact_samples = top->guest_kernel_samples = top->guest_us_samples = 0; } + +void prompt_integer(int *target, const char *msg) +{ + char *buf = malloc(0), *p; + size_t dummy = 0; + int tmp; + + fprintf(stdout, "\n%s: ", msg); + if (getline(&buf, &dummy, stdin) < 0) + return; + + p = strchr(buf, '\n'); + if (p) + *p = 0; + + p = buf; + while (*p) { + if (!isdigit(*p)) + goto out_free; + p++; + } + tmp = strtoul(buf, NULL, 10); + *target = tmp; +out_free: + free(buf); +} diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h index b554ffc..1538dab 100644 --- a/tools/perf/util/top.h +++ b/tools/perf/util/top.h @@ -43,4 +43,5 @@ struct perf_top { size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size); void perf_top__reset_sample_counters(struct perf_top *top); +void prompt_integer(int *target, const char *msg); #endif /* __PERF_TOP_H */ -- 1.7.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

