From d77a214b79887f7a5f93bee815ab17b491c06626 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Sat, 27 Oct 2012 23:18:31 +0200 Subject: [PATCH] --- yaml --- r: 338917 b: refs/heads/master c: ea36c46be69c6e49c877971c4b3b3876b24b6082 h: refs/heads/master i: 338915: eac20536d71fea3ebf3f0e4b69b60c1950ea43fa v: v3 --- [refs] | 2 +- trunk/tools/perf/util/string.c | 18 ++++++++++++++++++ trunk/tools/perf/util/symbol.c | 10 ---------- trunk/tools/perf/util/symbol.h | 2 -- trunk/tools/perf/util/util.h | 1 + 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index d14557d05520..96258c5e8f37 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b2aff5f615793fa4c1313d82635b83cd7de8d9fd +refs/heads/master: ea36c46be69c6e49c877971c4b3b3876b24b6082 diff --git a/trunk/tools/perf/util/string.c b/trunk/tools/perf/util/string.c index 32170590892d..346707df04b9 100644 --- a/trunk/tools/perf/util/string.c +++ b/trunk/tools/perf/util/string.c @@ -313,6 +313,24 @@ int strtailcmp(const char *s1, const char *s2) return 0; } +/** + * strxfrchar - Locate and replace character in @s + * @s: The string to be searched/changed. + * @from: Source character to be replaced. + * @to: Destination character. + * + * Return pointer to the changed string. + */ +char *strxfrchar(char *s, char from, char to) +{ + char *p = s; + + while ((p = strchr(p, from)) != NULL) + *p++ = to; + + return s; +} + /** * rtrim - Removes trailing whitespace from @s. * @s: The string to be stripped. diff --git a/trunk/tools/perf/util/symbol.c b/trunk/tools/perf/util/symbol.c index 08b825799a9e..d3b1ecc00cbc 100644 --- a/trunk/tools/perf/util/symbol.c +++ b/trunk/tools/perf/util/symbol.c @@ -2050,16 +2050,6 @@ int machines__create_kernel_maps(struct rb_root *machines, pid_t pid) return machine__create_kernel_maps(machine); } -char *strxfrchar(char *s, char from, char to) -{ - char *p = s; - - while ((p = strchr(p, from)) != NULL) - *p++ = to; - - return s; -} - int machines__create_guest_kernel_maps(struct rb_root *machines) { int ret = 0; diff --git a/trunk/tools/perf/util/symbol.h b/trunk/tools/perf/util/symbol.h index bc34dc1fb741..45d3df8d36d0 100644 --- a/trunk/tools/perf/util/symbol.h +++ b/trunk/tools/perf/util/symbol.h @@ -40,8 +40,6 @@ static inline char *bfd_demangle(void __maybe_unused *v, #endif #endif -char *strxfrchar(char *s, char from, char to); - /* * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; * for newer versions we can use mmap to reduce memory usage: diff --git a/trunk/tools/perf/util/util.h b/trunk/tools/perf/util/util.h index d6c22c51911b..c2330918110c 100644 --- a/trunk/tools/perf/util/util.h +++ b/trunk/tools/perf/util/util.h @@ -240,6 +240,7 @@ void argv_free(char **argv); bool strglobmatch(const char *str, const char *pat); bool strlazymatch(const char *str, const char *pat); int strtailcmp(const char *s1, const char *s2); +char *strxfrchar(char *s, char from, char to); unsigned long convert_unit(unsigned long value, char *unit); int readn(int fd, void *buf, size_t size);