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:
Arnaldo Carvalho de Melo 2019-06-26 11:42:03 -03:00
parent 526bbbdd44
commit 328584804e
11 changed files with 23 additions and 38 deletions

View file

@ -2,6 +2,7 @@
#ifndef PERF_STRING_H
#define PERF_STRING_H
#include <linux/string.h>
#include <linux/types.h>
#include <stddef.h>
#include <string.h>
@ -22,12 +23,11 @@ static inline bool strisglob(const char *str)
int strtailcmp(const char *s1, const char *s2);
char *strxfrchar(char *s, char from, char to);
char *ltrim(char *s);
char *rtrim(char *s);
static inline char *trim(char *s)
{
return ltrim(rtrim(s));
return skip_spaces(rtrim(s));
}
char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints);