summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index c72ab50d65ca..c6706984b7b3 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -287,19 +287,20 @@ out_unlock:
pthread_mutex_unlock(&syme->src->lock);
}
+#define PATTERN_LEN (BITS_PER_LONG / 4 + 2)
+
static void lookup_sym_source(struct sym_entry *syme)
{
struct symbol *symbol = sym_entry__symbol(syme);
struct source_line *line;
- const size_t pattern_len = BITS_PER_LONG / 4 + 2;
- char pattern[pattern_len + 1];
+ char pattern[PATTERN_LEN + 1];
sprintf(pattern, "%0*Lx <", BITS_PER_LONG / 4,
map__rip_2objdump(syme->map, symbol->start));
pthread_mutex_lock(&syme->src->lock);
for (line = syme->src->lines; line; line = line->next) {
- if (memcmp(line->line, pattern, pattern_len) == 0) {
+ if (memcmp(line->line, pattern, PATTERN_LEN) == 0) {
syme->src->source = line;
break;
}