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>
This commit is contained in:
parent
b2aff5f615
commit
ea36c46be6
|
@ -313,6 +313,24 @@ int strtailcmp(const char *s1, const char *s2)
|
||||||
return 0;
|
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.
|
* rtrim - Removes trailing whitespace from @s.
|
||||||
* @s: The string to be stripped.
|
* @s: The string to be stripped.
|
||||||
|
|
|
@ -2050,16 +2050,6 @@ int machines__create_kernel_maps(struct rb_root *machines, pid_t pid)
|
||||||
return machine__create_kernel_maps(machine);
|
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 machines__create_guest_kernel_maps(struct rb_root *machines)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
|
@ -40,8 +40,6 @@ static inline char *bfd_demangle(void __maybe_unused *v,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *strxfrchar(char *s, char from, char to);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
|
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
|
||||||
* for newer versions we can use mmap to reduce memory usage:
|
* for newer versions we can use mmap to reduce memory usage:
|
||||||
|
|
|
@ -240,6 +240,7 @@ void argv_free(char **argv);
|
||||||
bool strglobmatch(const char *str, const char *pat);
|
bool strglobmatch(const char *str, const char *pat);
|
||||||
bool strlazymatch(const char *str, const char *pat);
|
bool strlazymatch(const char *str, const char *pat);
|
||||||
int strtailcmp(const char *s1, const char *s2);
|
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);
|
unsigned long convert_unit(unsigned long value, char *unit);
|
||||||
int readn(int fd, void *buf, size_t size);
|
int readn(int fd, void *buf, size_t size);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue