mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
perf tools: Ditch rtrim(), use skip_spaces() to get closer to the kernel
No change in behaviour, just using the same kernel idiom for such operation. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: André Goddard Rosa <andre.goddard@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-a85lkptkt0ru40irpga8yf54@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
526bbbdd44
commit
328584804e
11 changed files with 23 additions and 38 deletions
|
@ -2880,7 +2880,7 @@ static int read_script_info(struct script_desc *desc, const char *filename)
|
|||
return -1;
|
||||
|
||||
while (fgets(line, sizeof(line), fp)) {
|
||||
p = ltrim(line);
|
||||
p = skip_spaces(line);
|
||||
if (strlen(p) == 0)
|
||||
continue;
|
||||
if (*p != '#')
|
||||
|
@ -2889,19 +2889,19 @@ static int read_script_info(struct script_desc *desc, const char *filename)
|
|||
if (strlen(p) && *p == '!')
|
||||
continue;
|
||||
|
||||
p = ltrim(p);
|
||||
p = skip_spaces(p);
|
||||
if (strlen(p) && p[strlen(p) - 1] == '\n')
|
||||
p[strlen(p) - 1] = '\0';
|
||||
|
||||
if (!strncmp(p, "description:", strlen("description:"))) {
|
||||
p += strlen("description:");
|
||||
desc->half_liner = strdup(ltrim(p));
|
||||
desc->half_liner = strdup(skip_spaces(p));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strncmp(p, "args:", strlen("args:"))) {
|
||||
p += strlen("args:");
|
||||
desc->args = strdup(ltrim(p));
|
||||
desc->args = strdup(skip_spaces(p));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -3008,7 +3008,7 @@ static int check_ev_match(char *dir_name, char *scriptname,
|
|||
return -1;
|
||||
|
||||
while (fgets(line, sizeof(line), fp)) {
|
||||
p = ltrim(line);
|
||||
p = skip_spaces(line);
|
||||
if (*p == '#')
|
||||
continue;
|
||||
|
||||
|
@ -3018,7 +3018,7 @@ static int check_ev_match(char *dir_name, char *scriptname,
|
|||
break;
|
||||
|
||||
p += 2;
|
||||
p = ltrim(p);
|
||||
p = skip_spaces(p);
|
||||
len = strcspn(p, " \t");
|
||||
if (!len)
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue