summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-06-26 11:45:09 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-07-01 21:50:40 -0400
commitaf0de0c5f060b1d4eae6033043eb9eafd15aa738 (patch)
tree4e80b9e526e03335f0f0b6256d35261531c1b61e
parent2a60689a33a61f000bd90596b1289babcb861cd9 (diff)
perf tools: Drop strxfrchar(), use strreplace() equivalent from kernel
No change in behaviour intended, just reducing the codebase and using something available in tools/lib/. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-oyi6zif3810nwi4uu85odnhv@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/dso.c3
-rw-r--r--tools/perf/util/string.c18
-rw-r--r--tools/perf/util/string2.h1
3 files changed, 2 insertions, 20 deletions
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 1fb18292c2d3..c7fde04400f7 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -1,6 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2#include <asm/bug.h> 2#include <asm/bug.h>
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/string.h>
4#include <sys/time.h> 5#include <sys/time.h>
5#include <sys/resource.h> 6#include <sys/resource.h>
6#include <sys/types.h> 7#include <sys/types.h>
@@ -394,7 +395,7 @@ int __kmod_path__parse(struct kmod_path *m, const char *path,
394 return -ENOMEM; 395 return -ENOMEM;
395 } 396 }
396 397
397 strxfrchar(m->name, '-', '_'); 398 strreplace(m->name, '-', '_');
398 } 399 }
399 400
400 return 0; 401 return 0;
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
index 93a5340424df..9b7fbb0cbecd 100644
--- a/tools/perf/util/string.c
+++ b/tools/perf/util/string.c
@@ -300,24 +300,6 @@ int strtailcmp(const char *s1, const char *s2)
300 return 0; 300 return 0;
301} 301}
302 302
303/**
304 * strxfrchar - Locate and replace character in @s
305 * @s: The string to be searched/changed.
306 * @from: Source character to be replaced.
307 * @to: Destination character.
308 *
309 * Return pointer to the changed string.
310 */
311char *strxfrchar(char *s, char from, char to)
312{
313 char *p = s;
314
315 while ((p = strchr(p, from)) != NULL)
316 *p++ = to;
317
318 return s;
319}
320
321char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints) 303char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints)
322{ 304{
323 /* 305 /*
diff --git a/tools/perf/util/string2.h b/tools/perf/util/string2.h
index 6da835ad8f5b..2696c3fcd780 100644
--- a/tools/perf/util/string2.h
+++ b/tools/perf/util/string2.h
@@ -21,7 +21,6 @@ static inline bool strisglob(const char *str)
21 return strpbrk(str, "*?[") != NULL; 21 return strpbrk(str, "*?[") != NULL;
22} 22}
23int strtailcmp(const char *s1, const char *s2); 23int strtailcmp(const char *s1, const char *s2);
24char *strxfrchar(char *s, char from, char to);
25 24
26char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints); 25char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
27 26