diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-03-23 09:57:08 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-03-23 15:46:19 -0400 |
commit | c448234cfe46ec5abc0014dca8b3b49989bffe9e (patch) | |
tree | d6b22391f3e67bc9c8b94b57b085fac4d49487da /tools/perf | |
parent | e4cc91b8027dbbb8a1f7c24cdecf58cd0b50375f (diff) |
perf annotate: Defer searching for comma in raw line till it is needed
That strchr() in jump__scnprintf() needs to be nuked somehow, as it,
IIRC is already done in jump__parse() and if needed at scnprintf() time,
should be stashed in the struct filled in parse() time.
For now jus defer it to just before where it is used.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-j0t5hagnphoz9xw07bh3ha3g@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/annotate.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 5fa270b24eea..f730e0cf8a26 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -350,7 +350,7 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op | |||
350 | static int jump__scnprintf(struct ins *ins, char *bf, size_t size, | 350 | static int jump__scnprintf(struct ins *ins, char *bf, size_t size, |
351 | struct ins_operands *ops) | 351 | struct ins_operands *ops) |
352 | { | 352 | { |
353 | const char *c = strchr(ops->raw, ','); | 353 | const char *c; |
354 | 354 | ||
355 | if (!ops->target.addr || ops->target.offset < 0) | 355 | if (!ops->target.addr || ops->target.offset < 0) |
356 | return ins__raw_scnprintf(ins, bf, size, ops); | 356 | return ins__raw_scnprintf(ins, bf, size, ops); |
@@ -358,6 +358,7 @@ static int jump__scnprintf(struct ins *ins, char *bf, size_t size, | |||
358 | if (ops->target.outside && ops->target.sym != NULL) | 358 | if (ops->target.outside && ops->target.sym != NULL) |
359 | return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.sym->name); | 359 | return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.sym->name); |
360 | 360 | ||
361 | c = strchr(ops->raw, ','); | ||
361 | if (c != NULL) { | 362 | if (c != NULL) { |
362 | const char *c2 = strchr(c + 1, ','); | 363 | const char *c2 = strchr(c + 1, ','); |
363 | 364 | ||