perf probe: Use skip_spaces() for argv handling

The skip_sep() routine has the same implementation as skip_spaces(),
recently adopted from the kernel, sources, switch to it.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-0ix211a81z2016dl5nmtdci4@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 9bb5a27a
...@@ -69,18 +69,6 @@ s64 perf_atoll(const char *str) ...@@ -69,18 +69,6 @@ s64 perf_atoll(const char *str)
return -1; return -1;
} }
/*
* Helper function for splitting a string into an argv-like array.
* originally copied from lib/argv_split.c
*/
static const char *skip_sep(const char *cp)
{
while (*cp && isspace(*cp))
cp++;
return cp;
}
static const char *skip_arg(const char *cp) static const char *skip_arg(const char *cp)
{ {
while (*cp && !isspace(*cp)) while (*cp && !isspace(*cp))
...@@ -94,7 +82,7 @@ static int count_argc(const char *str) ...@@ -94,7 +82,7 @@ static int count_argc(const char *str)
int count = 0; int count = 0;
while (*str) { while (*str) {
str = skip_sep(str); str = skip_spaces(str);
if (*str) { if (*str) {
count++; count++;
str = skip_arg(str); str = skip_arg(str);
...@@ -148,7 +136,7 @@ char **argv_split(const char *str, int *argcp) ...@@ -148,7 +136,7 @@ char **argv_split(const char *str, int *argcp)
argvp = argv; argvp = argv;
while (*str) { while (*str) {
str = skip_sep(str); str = skip_spaces(str);
if (*str) { if (*str) {
const char *p = str; const char *p = str;
......
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