diff options
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) | |||
294 | { | 294 | { |
295 | return __match_glob(str, pat, true); | 295 | return __match_glob(str, pat, true); |
296 | } | 296 | } |
297 | |||
298 | /** | ||
299 | * strtailcmp - Compare the tail of two strings | ||
300 | * @s1: 1st string to be compared | ||
301 | * @s2: 2nd string to be compared | ||
302 | * | ||
303 | * Return 0 if whole of either string is same as another's tail part. | ||
304 | */ | ||
305 | int strtailcmp(const char *s1, const char *s2) | ||
306 | { | ||
307 | int i1 = strlen(s1); | ||
308 | int i2 = strlen(s2); | ||
309 | while (--i1 >= 0 && --i2 >= 0) { | ||
310 | if (s1[i1] != s2[i2]) | ||
311 | return s1[i1] - s2[i2]; | ||
312 | } | ||
313 | return 0; | ||
314 | } | ||
315 | |||