diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-23 15:44:49 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-23 15:53:05 -0400 |
commit | 88fd633cdfa19060a6575b1d53c55c14b11e4fe8 (patch) | |
tree | a0232771b3961926be3497cbb608f4e3b16ff9f7 /tools/perf | |
parent | a610f5cbb2a7e26b7f2df2f5df255e34007d6bfd (diff) |
perf probe: No need to use formatting strbuf method
We have addch() for chars, add() for fixed size data, and addstr() for
variable length strings, use them.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-0ap02fn2xtvpduj2j6b2o1j4@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/dwarf-aux.c | 10 | ||||
-rw-r--r-- | tools/perf/util/probe-event.c | 2 | ||||
-rw-r--r-- | tools/perf/util/probe-finder.c | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c index a509aa8433a1..577e600c8eb1 100644 --- a/tools/perf/util/dwarf-aux.c +++ b/tools/perf/util/dwarf-aux.c | |||
@@ -915,7 +915,7 @@ int die_get_typename(Dwarf_Die *vr_die, struct strbuf *buf) | |||
915 | tmp = "*"; | 915 | tmp = "*"; |
916 | else if (tag == DW_TAG_subroutine_type) { | 916 | else if (tag == DW_TAG_subroutine_type) { |
917 | /* Function pointer */ | 917 | /* Function pointer */ |
918 | strbuf_addf(buf, "(function_type)"); | 918 | strbuf_add(buf, "(function_type)", 15); |
919 | return 0; | 919 | return 0; |
920 | } else { | 920 | } else { |
921 | if (!dwarf_diename(&type)) | 921 | if (!dwarf_diename(&type)) |
@@ -932,7 +932,7 @@ int die_get_typename(Dwarf_Die *vr_die, struct strbuf *buf) | |||
932 | } | 932 | } |
933 | ret = die_get_typename(&type, buf); | 933 | ret = die_get_typename(&type, buf); |
934 | if (ret == 0) | 934 | if (ret == 0) |
935 | strbuf_addf(buf, "%s", tmp); | 935 | strbuf_addstr(buf, tmp); |
936 | 936 | ||
937 | return ret; | 937 | return ret; |
938 | } | 938 | } |
@@ -951,7 +951,7 @@ int die_get_varname(Dwarf_Die *vr_die, struct strbuf *buf) | |||
951 | ret = die_get_typename(vr_die, buf); | 951 | ret = die_get_typename(vr_die, buf); |
952 | if (ret < 0) { | 952 | if (ret < 0) { |
953 | pr_debug("Failed to get type, make it unknown.\n"); | 953 | pr_debug("Failed to get type, make it unknown.\n"); |
954 | strbuf_addf(buf, "(unknown_type)"); | 954 | strbuf_add(buf, " (unknown_type)", 14); |
955 | } | 955 | } |
956 | 956 | ||
957 | strbuf_addf(buf, "\t%s", dwarf_diename(vr_die)); | 957 | strbuf_addf(buf, "\t%s", dwarf_diename(vr_die)); |
@@ -1013,7 +1013,7 @@ static int die_get_var_innermost_scope(Dwarf_Die *sp_die, Dwarf_Die *vr_die, | |||
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | if (!first) | 1015 | if (!first) |
1016 | strbuf_addf(buf, "]>"); | 1016 | strbuf_add(buf, "]>", 2); |
1017 | 1017 | ||
1018 | out: | 1018 | out: |
1019 | free(scopes); | 1019 | free(scopes); |
@@ -1076,7 +1076,7 @@ int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf) | |||
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | if (!first) | 1078 | if (!first) |
1079 | strbuf_addf(buf, "]>"); | 1079 | strbuf_add(buf, "]>", 2); |
1080 | 1080 | ||
1081 | return ret; | 1081 | return ret; |
1082 | } | 1082 | } |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 93996ec4bbe3..8319fbb08636 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -2179,7 +2179,7 @@ static int perf_probe_event__sprintf(const char *group, const char *event, | |||
2179 | strbuf_addf(result, " in %s", module); | 2179 | strbuf_addf(result, " in %s", module); |
2180 | 2180 | ||
2181 | if (pev->nargs > 0) { | 2181 | if (pev->nargs > 0) { |
2182 | strbuf_addstr(result, " with"); | 2182 | strbuf_add(result, " with", 5); |
2183 | for (i = 0; i < pev->nargs; i++) { | 2183 | for (i = 0; i < pev->nargs; i++) { |
2184 | ret = synthesize_perf_probe_arg(&pev->args[i], | 2184 | ret = synthesize_perf_probe_arg(&pev->args[i], |
2185 | buf, 128); | 2185 | buf, 128); |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 4ce5c5e18f48..b3bd0fba0237 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -1314,18 +1314,18 @@ static int collect_variables_cb(Dwarf_Die *die_mem, void *data) | |||
1314 | if (probe_conf.show_location_range) { | 1314 | if (probe_conf.show_location_range) { |
1315 | if (!externs) { | 1315 | if (!externs) { |
1316 | if (ret) | 1316 | if (ret) |
1317 | strbuf_addf(&buf, "[INV]\t"); | 1317 | strbuf_add(&buf, "[INV]\t", 6); |
1318 | else | 1318 | else |
1319 | strbuf_addf(&buf, "[VAL]\t"); | 1319 | strbuf_add(&buf, "[VAL]\t", 6); |
1320 | } else | 1320 | } else |
1321 | strbuf_addf(&buf, "[EXT]\t"); | 1321 | strbuf_add(&buf, "[EXT]\t", 6); |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | ret2 = die_get_varname(die_mem, &buf); | 1324 | ret2 = die_get_varname(die_mem, &buf); |
1325 | 1325 | ||
1326 | if (!ret2 && probe_conf.show_location_range && | 1326 | if (!ret2 && probe_conf.show_location_range && |
1327 | !externs) { | 1327 | !externs) { |
1328 | strbuf_addf(&buf, "\t"); | 1328 | strbuf_addch(&buf, '\t'); |
1329 | ret2 = die_get_var_range(&af->pf.sp_die, | 1329 | ret2 = die_get_var_range(&af->pf.sp_die, |
1330 | die_mem, &buf); | 1330 | die_mem, &buf); |
1331 | } | 1331 | } |