diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-05-01 08:47:44 -0700 | 
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-05-01 08:47:44 -0700 | 
| commit | bf61c8840efe60fd8f91446860b63338fb424158 (patch) | |
| tree | 7a71832407a4f0d6346db773343f4c3ae2257b19 /tools/perf/util/string.c | |
| parent | 5846115b30f3a881e542c8bfde59a699c1c13740 (diff) | |
| parent | 0c6a61657da78098472fd0eb71cc01f2387fa1bb (diff) | |
| download | olio-linux-3.10-bf61c8840efe60fd8f91446860b63338fb424158.tar.xz olio-linux-3.10-bf61c8840efe60fd8f91446860b63338fb424158.zip  | |
Merge branch 'next' into for-linus
Prepare first set of updates for 3.10 merge window.
Diffstat (limited to 'tools/perf/util/string.c')
| -rw-r--r-- | tools/perf/util/string.c | 36 | 
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index 32170590892..29c7b2cb252 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c @@ -314,6 +314,42 @@ int strtailcmp(const char *s1, const char *s2)  }  /** + * 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; +} + +/** + * ltrim - Removes leading whitespace from @s. + * @s: The string to be stripped. + * + * Return pointer to the first non-whitespace character in @s. + */ +char *ltrim(char *s) +{ +	int len = strlen(s); + +	while (len && isspace(*s)) { +		len--; +		s++; +	} + +	return s; +} + +/**   * rtrim - Removes trailing whitespace from @s.   * @s: The string to be stripped.   *  |