Skip to content

Commit 88fd633

Browse files
committed
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>
1 parent a610f5c commit 88fd633

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

tools/perf/util/dwarf-aux.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ int die_get_typename(Dwarf_Die *vr_die, struct strbuf *buf)
915915
tmp = "*";
916916
else if (tag == DW_TAG_subroutine_type) {
917917
/* Function pointer */
918-
strbuf_addf(buf, "(function_type)");
918+
strbuf_add(buf, "(function_type)", 15);
919919
return 0;
920920
} else {
921921
if (!dwarf_diename(&type))
@@ -932,7 +932,7 @@ int die_get_typename(Dwarf_Die *vr_die, struct strbuf *buf)
932932
}
933933
ret = die_get_typename(&type, buf);
934934
if (ret == 0)
935-
strbuf_addf(buf, "%s", tmp);
935+
strbuf_addstr(buf, tmp);
936936

937937
return ret;
938938
}
@@ -951,7 +951,7 @@ int die_get_varname(Dwarf_Die *vr_die, struct strbuf *buf)
951951
ret = die_get_typename(vr_die, buf);
952952
if (ret < 0) {
953953
pr_debug("Failed to get type, make it unknown.\n");
954-
strbuf_addf(buf, "(unknown_type)");
954+
strbuf_add(buf, " (unknown_type)", 14);
955955
}
956956

957957
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,
10131013
}
10141014

10151015
if (!first)
1016-
strbuf_addf(buf, "]>");
1016+
strbuf_add(buf, "]>", 2);
10171017

10181018
out:
10191019
free(scopes);
@@ -1076,7 +1076,7 @@ int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf)
10761076
}
10771077

10781078
if (!first)
1079-
strbuf_addf(buf, "]>");
1079+
strbuf_add(buf, "]>", 2);
10801080

10811081
return ret;
10821082
}

tools/perf/util/probe-event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ static int perf_probe_event__sprintf(const char *group, const char *event,
21792179
strbuf_addf(result, " in %s", module);
21802180

21812181
if (pev->nargs > 0) {
2182-
strbuf_addstr(result, " with");
2182+
strbuf_add(result, " with", 5);
21832183
for (i = 0; i < pev->nargs; i++) {
21842184
ret = synthesize_perf_probe_arg(&pev->args[i],
21852185
buf, 128);

tools/perf/util/probe-finder.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,18 +1314,18 @@ static int collect_variables_cb(Dwarf_Die *die_mem, void *data)
13141314
if (probe_conf.show_location_range) {
13151315
if (!externs) {
13161316
if (ret)
1317-
strbuf_addf(&buf, "[INV]\t");
1317+
strbuf_add(&buf, "[INV]\t", 6);
13181318
else
1319-
strbuf_addf(&buf, "[VAL]\t");
1319+
strbuf_add(&buf, "[VAL]\t", 6);
13201320
} else
1321-
strbuf_addf(&buf, "[EXT]\t");
1321+
strbuf_add(&buf, "[EXT]\t", 6);
13221322
}
13231323

13241324
ret2 = die_get_varname(die_mem, &buf);
13251325

13261326
if (!ret2 && probe_conf.show_location_range &&
13271327
!externs) {
1328-
strbuf_addf(&buf, "\t");
1328+
strbuf_addch(&buf, '\t');
13291329
ret2 = die_get_var_range(&af->pf.sp_die,
13301330
die_mem, &buf);
13311331
}

0 commit comments

Comments
 (0)