diff options
| author | Arnaldo Carvalho de Melo <[email protected]> | 2017-04-07 15:19:38 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2017-04-11 18:23:39 +0000 |
| commit | ecbe5e10d4ad12dd3da5d9fccd153c529c8c8ce1 (patch) | |
| tree | b24dd13689e734daf441ea219efeb742bf8c73c4 /tools/perf/util/annotate.c | |
| parent | perf tools: Refactor the code to strip command name with {l,r}trim() (diff) | |
| download | kernel-ecbe5e10d4ad12dd3da5d9fccd153c529c8c8ce1.tar.gz kernel-ecbe5e10d4ad12dd3da5d9fccd153c529c8c8ce1.zip | |
perf string: Simplify ltrim() implementation
We don't need to use strlen(), a var, or check for the end explicitely,
isspace('\0') is false:
[acme@jouet c]$ cat ltrim.c
#include <ctype.h>
#include <stdio.h>
static char *ltrim(char *s)
{
while (isspace(*s))
++s;
return s;
}
int main(void)
{
printf("ltrim(\"\")='%s'\n", ltrim(""));
return 0;
}
[acme@jouet c]$ ./ltrim
ltrim("")=''
[acme@jouet c]$
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Taeung Song <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/annotate.c')
0 files changed, 0 insertions, 0 deletions
