diff options
author | Ingo Molnar <mingo@elte.hu> | 2011-07-21 09:32:40 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-07-21 09:32:40 +0200 |
commit | 40bcea7bbe8fe452a2d272e2ffd3dea281eec9ff (patch) | |
tree | aedb6d02e53e3cf84cc32fd81db84032cee205e1 /tools/perf/util/string.c | |
parent | 492f73a303b488ffd67097b2351d54aa6e6c7c73 (diff) | |
parent | 14a8fd7ceea6915c613746203d6e9a2bf273f16c (diff) |
Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core
Diffstat (limited to 'tools/perf/util/string.c')
-rw-r--r-- | tools/perf/util/string.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index b9a985dadd0..d5836382ff2 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c @@ -294,3 +294,22 @@ bool strlazymatch(const char *str, const char *pat) { return __match_glob(str, pat, true); } + +/** + * strtailcmp - Compare the tail of two strings + * @s1: 1st string to be compared + * @s2: 2nd string to be compared + * + * Return 0 if whole of either string is same as another's tail part. + */ +int strtailcmp(const char *s1, const char *s2) +{ + int i1 = strlen(s1); + int i2 = strlen(s2); + while (--i1 >= 0 && --i2 >= 0) { + if (s1[i1] != s2[i2]) + return s1[i1] - s2[i2]; + } + return 0; +} + |