aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2016-05-11 09:51:59 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-05-11 12:06:06 -0400
commitb5d8bbe8601a45b908f7952707bbb30bf221ca3b (patch)
tree238a8b18d26b9337e0ab6376c809a7d98deab1d7
parent357a54f32a065835d3e6a08b07a91a57e52f32c7 (diff)
perf tools: Use SBUILD_ID_SIZE where applicable
Use the existing SBUILD_ID_SIZE macro instead of the equivalent BUILD_ID_SIZE * 2 + 1 expression for allocating a buffer for build-id strings. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Hemant Kumar <hemant@linux.vnet.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20160511135159.23943.57120.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/annotate.c2
-rw-r--r--tools/perf/util/dso.c4
-rw-r--r--tools/perf/util/header.c2
-rw-r--r--tools/perf/util/map.c2
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c2
-rw-r--r--tools/perf/util/symbol.c2
6 files changed, 7 insertions, 7 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index d4b3d034c503..4db73d5a0dbc 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1138,7 +1138,7 @@ fallback:
1138 1138
1139 if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && 1139 if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
1140 !dso__is_kcore(dso)) { 1140 !dso__is_kcore(dso)) {
1141 char bf[BUILD_ID_SIZE * 2 + 16] = " with build id "; 1141 char bf[SBUILD_ID_SIZE + 15] = " with build id ";
1142 char *build_id_msg = NULL; 1142 char *build_id_msg = NULL;
1143 1143
1144 if (dso->annotate_warned) 1144 if (dso->annotate_warned)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 8e6395439ca0..3357479082ca 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -38,7 +38,7 @@ int dso__read_binary_type_filename(const struct dso *dso,
38 enum dso_binary_type type, 38 enum dso_binary_type type,
39 char *root_dir, char *filename, size_t size) 39 char *root_dir, char *filename, size_t size)
40{ 40{
41 char build_id_hex[BUILD_ID_SIZE * 2 + 1]; 41 char build_id_hex[SBUILD_ID_SIZE];
42 int ret = 0; 42 int ret = 0;
43 size_t len; 43 size_t len;
44 44
@@ -1301,7 +1301,7 @@ size_t __dsos__fprintf(struct list_head *head, FILE *fp)
1301 1301
1302size_t dso__fprintf_buildid(struct dso *dso, FILE *fp) 1302size_t dso__fprintf_buildid(struct dso *dso, FILE *fp)
1303{ 1303{
1304 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 1304 char sbuild_id[SBUILD_ID_SIZE];
1305 1305
1306 build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); 1306 build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
1307 return fprintf(fp, "%s", sbuild_id); 1307 return fprintf(fp, "%s", sbuild_id);
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index c6000d44f98c..08852dde1378 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1474,7 +1474,7 @@ static int __event_process_build_id(struct build_id_event *bev,
1474 1474
1475 dso = machine__findnew_dso(machine, filename); 1475 dso = machine__findnew_dso(machine, filename);
1476 if (dso != NULL) { 1476 if (dso != NULL) {
1477 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 1477 char sbuild_id[SBUILD_ID_SIZE];
1478 1478
1479 dso__set_build_id(dso, &bev->build_id); 1479 dso__set_build_id(dso, &bev->build_id);
1480 1480
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 02c31865648b..b19bcd3b7128 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -289,7 +289,7 @@ int map__load(struct map *map, symbol_filter_t filter)
289 nr = dso__load(map->dso, map, filter); 289 nr = dso__load(map->dso, map, filter);
290 if (nr < 0) { 290 if (nr < 0) {
291 if (map->dso->has_build_id) { 291 if (map->dso->has_build_id) {
292 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 292 char sbuild_id[SBUILD_ID_SIZE];
293 293
294 build_id__sprintf(map->dso->build_id, 294 build_id__sprintf(map->dso->build_id,
295 sizeof(map->dso->build_id), 295 sizeof(map->dso->build_id),
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 73ee12d96c33..ff134700bf30 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -618,7 +618,7 @@ static int python_export_dso(struct db_export *dbe, struct dso *dso,
618 struct machine *machine) 618 struct machine *machine)
619{ 619{
620 struct tables *tables = container_of(dbe, struct tables, dbe); 620 struct tables *tables = container_of(dbe, struct tables, dbe);
621 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 621 char sbuild_id[SBUILD_ID_SIZE];
622 PyObject *t; 622 PyObject *t;
623 623
624 build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); 624 build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 21af8e8891fe..4ada5a44aaf2 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1642,7 +1642,7 @@ static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
1642static char *dso__find_kallsyms(struct dso *dso, struct map *map) 1642static char *dso__find_kallsyms(struct dso *dso, struct map *map)
1643{ 1643{
1644 u8 host_build_id[BUILD_ID_SIZE]; 1644 u8 host_build_id[BUILD_ID_SIZE];
1645 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 1645 char sbuild_id[SBUILD_ID_SIZE];
1646 bool is_host = false; 1646 bool is_host = false;
1647 char path[PATH_MAX]; 1647 char path[PATH_MAX];
1648 1648