From 49acdf89c0e650f82e20d710583e758fc3afa6ac Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Tue, 22 Jan 2013 18:09:41 +0900 Subject: [PATCH] --- yaml --- r: 349972 b: refs/heads/master c: 08aa9cce6bf3ecdfa386cf0a0be842855eac3e7d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/tools/perf/builtin-script.c | 12 ------------ trunk/tools/perf/util/string.c | 18 ++++++++++++++++++ trunk/tools/perf/util/util.h | 1 + 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index f48d1fcacc35..260dff2dd68e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 15268138e334bd0362f8395edac4822351714a22 +refs/heads/master: 08aa9cce6bf3ecdfa386cf0a0be842855eac3e7d diff --git a/trunk/tools/perf/builtin-script.c b/trunk/tools/perf/builtin-script.c index 3314ef2ec83e..fee4c9a8aee5 100644 --- a/trunk/tools/perf/builtin-script.c +++ b/trunk/tools/perf/builtin-script.c @@ -909,18 +909,6 @@ static const char *ends_with(const char *str, const char *suffix) return NULL; } -static char *ltrim(char *str) -{ - int len = strlen(str); - - while (len && isspace(*str)) { - len--; - str++; - } - - return str; -} - static int read_script_info(struct script_desc *desc, const char *filename) { char line[BUFSIZ], *p; diff --git a/trunk/tools/perf/util/string.c b/trunk/tools/perf/util/string.c index 346707df04b9..29c7b2cb2521 100644 --- a/trunk/tools/perf/util/string.c +++ b/trunk/tools/perf/util/string.c @@ -331,6 +331,24 @@ char *strxfrchar(char *s, char from, char 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. diff --git a/trunk/tools/perf/util/util.h b/trunk/tools/perf/util/util.h index ec5de5e3330c..09b4c26b71aa 100644 --- a/trunk/tools/perf/util/util.h +++ b/trunk/tools/perf/util/util.h @@ -265,6 +265,7 @@ bool is_power_of_2(unsigned long n) size_t hex_width(u64 v); int hex2u64(const char *ptr, u64 *val); +char *ltrim(char *s); char *rtrim(char *s); void dump_stack(void);