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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 2a60689a
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <asm/bug.h> #include <asm/bug.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -394,7 +395,7 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, ...@@ -394,7 +395,7 @@ int __kmod_path__parse(struct kmod_path *m, const char *path,
return -ENOMEM; return -ENOMEM;
} }
strxfrchar(m->name, '-', '_'); strreplace(m->name, '-', '_');
} }
return 0; return 0;
......
...@@ -300,24 +300,6 @@ int strtailcmp(const char *s1, const char *s2) ...@@ -300,24 +300,6 @@ 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;
}
char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints) char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints)
{ {
/* /*
......
...@@ -21,7 +21,6 @@ static inline bool strisglob(const char *str) ...@@ -21,7 +21,6 @@ static inline bool strisglob(const char *str)
return strpbrk(str, "*?[") != NULL; return strpbrk(str, "*?[") != NULL;
} }
int strtailcmp(const char *s1, const char *s2); int strtailcmp(const char *s1, const char *s2);
char *strxfrchar(char *s, char from, char to);
char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints); char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment