aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-10-27 17:18:31 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-29 09:36:28 -0400
commitea36c46be69c6e49c877971c4b3b3876b24b6082 (patch)
treeec78d35db49a20f0c2c653e83a605a141a5d3c95 /tools
parentb2aff5f615793fa4c1313d82635b83cd7de8d9fd (diff)
perf tools: Move strxfrchar into string object
Moving strxfrchar function into string object. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1351372712-21104-5-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/string.c18
-rw-r--r--tools/perf/util/symbol.c10
-rw-r--r--tools/perf/util/symbol.h2
-rw-r--r--tools/perf/util/util.h1
4 files changed, 19 insertions, 12 deletions
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
index 32170590892d..346707df04b9 100644
--- a/tools/perf/util/string.c
+++ b/tools/perf/util/string.c
@@ -314,6 +314,24 @@ int strtailcmp(const char *s1, const char *s2)
314} 314}
315 315
316/** 316/**
317 * strxfrchar - Locate and replace character in @s
318 * @s: The string to be searched/changed.
319 * @from: Source character to be replaced.
320 * @to: Destination character.
321 *
322 * Return pointer to the changed string.
323 */
324char *strxfrchar(char *s, char from, char to)
325{
326 char *p = s;
327
328 while ((p = strchr(p, from)) != NULL)
329 *p++ = to;
330
331 return s;
332}
333
334/**
317 * rtrim - Removes trailing whitespace from @s. 335 * rtrim - Removes trailing whitespace from @s.
318 * @s: The string to be stripped. 336 * @s: The string to be stripped.
319 * 337 *
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 08b825799a9e..d3b1ecc00cbc 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2050,16 +2050,6 @@ int machines__create_kernel_maps(struct rb_root *machines, pid_t pid)
2050 return machine__create_kernel_maps(machine); 2050 return machine__create_kernel_maps(machine);
2051} 2051}
2052 2052
2053char *strxfrchar(char *s, char from, char to)
2054{
2055 char *p = s;
2056
2057 while ((p = strchr(p, from)) != NULL)
2058 *p++ = to;
2059
2060 return s;
2061}
2062
2063int machines__create_guest_kernel_maps(struct rb_root *machines) 2053int machines__create_guest_kernel_maps(struct rb_root *machines)
2064{ 2054{
2065 int ret = 0; 2055 int ret = 0;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index bc34dc1fb741..45d3df8d36d0 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -40,8 +40,6 @@ static inline char *bfd_demangle(void __maybe_unused *v,
40#endif 40#endif
41#endif 41#endif
42 42
43char *strxfrchar(char *s, char from, char to);
44
45/* 43/*
46 * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP; 44 * libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
47 * for newer versions we can use mmap to reduce memory usage: 45 * for newer versions we can use mmap to reduce memory usage:
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index d6c22c51911b..c2330918110c 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -240,6 +240,7 @@ void argv_free(char **argv);
240bool strglobmatch(const char *str, const char *pat); 240bool strglobmatch(const char *str, const char *pat);
241bool strlazymatch(const char *str, const char *pat); 241bool strlazymatch(const char *str, const char *pat);
242int strtailcmp(const char *s1, const char *s2); 242int strtailcmp(const char *s1, const char *s2);
243char *strxfrchar(char *s, char from, char to);
243unsigned long convert_unit(unsigned long value, char *unit); 244unsigned long convert_unit(unsigned long value, char *unit);
244int readn(int fd, void *buf, size_t size); 245int readn(int fd, void *buf, size_t size);
245 246