diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2010-04-14 13:11:29 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-04-14 15:59:21 -0400 |
commit | fcd1498405c2c88ac632e7c3c3fce3213d9196db (patch) | |
tree | bba62d6928d259f2bd26d592432769fd3af0904b /tools/perf/util/hist.c | |
parent | df8290bf7ea6b3051e2f315579a6e829309ec1ed (diff) |
perf tools: Fix accidentally preprocessed snprintf callback
struct sort_entry has a callback named snprintf that turns an
entry into a string result.
But there are glibc versions that implement snprintf through a
macro. The following expression is then going to get the snprintf
call preprocessed:
ent->snprintf(...)
to finally end up in a build error:
util/hist.c: Dans la fonction «hist_entry__snprintf» :
util/hist.c:539: erreur: «struct sort_entry» has no member named «__builtin___snprintf_chk»
To fix this, prepend struct sort_entry callbacks with an "se_"
prefix.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/hist.c')
-rw-r--r-- | tools/perf/util/hist.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 18cf8b321608..9c2b8743cef6 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -68,7 +68,7 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry *right) | |||
68 | int64_t cmp = 0; | 68 | int64_t cmp = 0; |
69 | 69 | ||
70 | list_for_each_entry(se, &hist_entry__sort_list, list) { | 70 | list_for_each_entry(se, &hist_entry__sort_list, list) { |
71 | cmp = se->cmp(left, right); | 71 | cmp = se->se_cmp(left, right); |
72 | if (cmp) | 72 | if (cmp) |
73 | break; | 73 | break; |
74 | } | 74 | } |
@@ -85,7 +85,7 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right) | |||
85 | list_for_each_entry(se, &hist_entry__sort_list, list) { | 85 | list_for_each_entry(se, &hist_entry__sort_list, list) { |
86 | int64_t (*f)(struct hist_entry *, struct hist_entry *); | 86 | int64_t (*f)(struct hist_entry *, struct hist_entry *); |
87 | 87 | ||
88 | f = se->collapse ?: se->cmp; | 88 | f = se->se_collapse ?: se->se_cmp; |
89 | 89 | ||
90 | cmp = f(left, right); | 90 | cmp = f(left, right); |
91 | if (cmp) | 91 | if (cmp) |
@@ -536,8 +536,8 @@ int hist_entry__snprintf(struct hist_entry *self, | |||
536 | continue; | 536 | continue; |
537 | 537 | ||
538 | ret += snprintf(s + ret, size - ret, "%s", sep ?: " "); | 538 | ret += snprintf(s + ret, size - ret, "%s", sep ?: " "); |
539 | ret += se->snprintf(self, s + ret, size - ret, | 539 | ret += se->se_snprintf(self, s + ret, size - ret, |
540 | se->width ? *se->width : 0); | 540 | se->se_width ? *se->se_width : 0); |
541 | } | 541 | } |
542 | 542 | ||
543 | return ret; | 543 | return ret; |
@@ -564,7 +564,7 @@ static size_t hist_entry__fprintf_callchain(struct hist_entry *self, FILE *fp, | |||
564 | if (sort__first_dimension == SORT_COMM) { | 564 | if (sort__first_dimension == SORT_COMM) { |
565 | struct sort_entry *se = list_first_entry(&hist_entry__sort_list, | 565 | struct sort_entry *se = list_first_entry(&hist_entry__sort_list, |
566 | typeof(*se), list); | 566 | typeof(*se), list); |
567 | left_margin = se->width ? *se->width : 0; | 567 | left_margin = se->se_width ? *se->se_width : 0; |
568 | left_margin -= thread__comm_len(self->thread); | 568 | left_margin -= thread__comm_len(self->thread); |
569 | } | 569 | } |
570 | 570 | ||
@@ -615,22 +615,22 @@ size_t perf_session__fprintf_hists(struct rb_root *hists, | |||
615 | if (se->elide) | 615 | if (se->elide) |
616 | continue; | 616 | continue; |
617 | if (sep) { | 617 | if (sep) { |
618 | fprintf(fp, "%c%s", *sep, se->header); | 618 | fprintf(fp, "%c%s", *sep, se->se_header); |
619 | continue; | 619 | continue; |
620 | } | 620 | } |
621 | width = strlen(se->header); | 621 | width = strlen(se->se_header); |
622 | if (se->width) { | 622 | if (se->se_width) { |
623 | if (symbol_conf.col_width_list_str) { | 623 | if (symbol_conf.col_width_list_str) { |
624 | if (col_width) { | 624 | if (col_width) { |
625 | *se->width = atoi(col_width); | 625 | *se->se_width = atoi(col_width); |
626 | col_width = strchr(col_width, ','); | 626 | col_width = strchr(col_width, ','); |
627 | if (col_width) | 627 | if (col_width) |
628 | ++col_width; | 628 | ++col_width; |
629 | } | 629 | } |
630 | } | 630 | } |
631 | width = *se->width = max(*se->width, width); | 631 | width = *se->se_width = max(*se->se_width, width); |
632 | } | 632 | } |
633 | fprintf(fp, " %*s", width, se->header); | 633 | fprintf(fp, " %*s", width, se->se_header); |
634 | } | 634 | } |
635 | fprintf(fp, "\n"); | 635 | fprintf(fp, "\n"); |
636 | 636 | ||
@@ -652,10 +652,10 @@ size_t perf_session__fprintf_hists(struct rb_root *hists, | |||
652 | continue; | 652 | continue; |
653 | 653 | ||
654 | fprintf(fp, " "); | 654 | fprintf(fp, " "); |
655 | if (se->width) | 655 | if (se->se_width) |
656 | width = *se->width; | 656 | width = *se->se_width; |
657 | else | 657 | else |
658 | width = strlen(se->header); | 658 | width = strlen(se->se_header); |
659 | for (i = 0; i < width; i++) | 659 | for (i = 0; i < width; i++) |
660 | fprintf(fp, "."); | 660 | fprintf(fp, "."); |
661 | } | 661 | } |