perf tools: Use SBUILD_ID_SIZE where applicable
authorMasami Hiramatsu <mhiramat@kernel.org>
Wed, 11 May 2016 13:51:59 +0000 (22:51 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 11 May 2016 16:06:06 +0000 (13:06 -0300)
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>
tools/perf/util/annotate.c
tools/perf/util/dso.c
tools/perf/util/header.c
tools/perf/util/map.c
tools/perf/util/scripting-engines/trace-event-python.c
tools/perf/util/symbol.c

index d4b3d034c5031bdbf9a1dcc099812778f4e603c8..4db73d5a0dbc6bf421c57d50ff0db7560caff03f 100644 (file)
@@ -1138,7 +1138,7 @@ fallback:
 
        if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
            !dso__is_kcore(dso)) {
-               char bf[BUILD_ID_SIZE * 2 + 16] = " with build id ";
+               char bf[SBUILD_ID_SIZE + 15] = " with build id ";
                char *build_id_msg = NULL;
 
                if (dso->annotate_warned)
index 8e6395439ca0830cefaaa5b6dbe905ae2af93011..3357479082ca95b9b6cfd4df5015a30b470214fe 100644 (file)
@@ -38,7 +38,7 @@ int dso__read_binary_type_filename(const struct dso *dso,
                                   enum dso_binary_type type,
                                   char *root_dir, char *filename, size_t size)
 {
-       char build_id_hex[BUILD_ID_SIZE * 2 + 1];
+       char build_id_hex[SBUILD_ID_SIZE];
        int ret = 0;
        size_t len;
 
@@ -1301,7 +1301,7 @@ size_t __dsos__fprintf(struct list_head *head, FILE *fp)
 
 size_t dso__fprintf_buildid(struct dso *dso, FILE *fp)
 {
-       char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+       char sbuild_id[SBUILD_ID_SIZE];
 
        build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
        return fprintf(fp, "%s", sbuild_id);
index c6000d44f98c9848d8e3633dafb46ea3167f0cdd..08852dde1378696d24c47c0b34bded96b9d862e8 100644 (file)
@@ -1474,7 +1474,7 @@ static int __event_process_build_id(struct build_id_event *bev,
 
        dso = machine__findnew_dso(machine, filename);
        if (dso != NULL) {
-               char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+               char sbuild_id[SBUILD_ID_SIZE];
 
                dso__set_build_id(dso, &bev->build_id);
 
index 02c31865648b11aaf6569ce34014ce16f602e9f0..b19bcd3b7128355f67d93232b695966907a5e473 100644 (file)
@@ -289,7 +289,7 @@ int map__load(struct map *map, symbol_filter_t filter)
        nr = dso__load(map->dso, map, filter);
        if (nr < 0) {
                if (map->dso->has_build_id) {
-                       char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+                       char sbuild_id[SBUILD_ID_SIZE];
 
                        build_id__sprintf(map->dso->build_id,
                                          sizeof(map->dso->build_id),
index 73ee12d96c33ff77599638aee59131b0cdd9b61d..ff134700bf30dfa1f3bf772220ebb681daf077b2 100644 (file)
@@ -618,7 +618,7 @@ static int python_export_dso(struct db_export *dbe, struct dso *dso,
                             struct machine *machine)
 {
        struct tables *tables = container_of(dbe, struct tables, dbe);
-       char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+       char sbuild_id[SBUILD_ID_SIZE];
        PyObject *t;
 
        build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
index 21af8e8891fed48f72ba8996fabe6e6646d1e557..4ada5a44aaf2ad9195085efd50dd7bef2ad1c370 100644 (file)
@@ -1642,7 +1642,7 @@ static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz)
 static char *dso__find_kallsyms(struct dso *dso, struct map *map)
 {
        u8 host_build_id[BUILD_ID_SIZE];
-       char sbuild_id[BUILD_ID_SIZE * 2 + 1];
+       char sbuild_id[SBUILD_ID_SIZE];
        bool is_host = false;
        char path[PATH_MAX];