]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
perf probe: Move strtailcmp to string.c
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Mon, 27 Jun 2011 07:27:15 +0000 (16:27 +0900)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 15 Jul 2011 20:00:47 +0000 (16:00 -0400)
Since strtailcmp() is enough generic, it should be defined in string.c.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Link: http://lkml.kernel.org/r/20110627072715.6528.10677.stgit@fedora15
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tools/perf/util/probe-finder.c
tools/perf/util/string.c
tools/perf/util/util.h

index 7b78904a4dba439045d1983d9e9a41f32560329f..459ebe8b04f356a44affb4e4a24b34ac96e65dc1 100644 (file)
 /* Kprobe tracer basic type is up to u64 */
 #define MAX_BASIC_TYPE_BITS    64
 
-/*
- * Compare the tail of two strings.
- * Return 0 if whole of either string is same as another's tail part.
- */
-static 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;
-}
-
 /* Line number list operations */
 
 /* Add a line to line number list */
index b9a985dadd08f67851cc0483bb36bb8d3b014580..d5836382ff2cad7d00fd156d1296f99f8433f698 100644 (file)
@@ -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;
+}
+
index fc784284ac8be9070c1ab3681a216512150a3688..0128906bac88d258e9e100aeabae5abd462e465b 100644 (file)
@@ -238,6 +238,7 @@ char **argv_split(const char *str, int *argcp);
 void argv_free(char **argv);
 bool strglobmatch(const char *str, const char *pat);
 bool strlazymatch(const char *str, const char *pat);
+int strtailcmp(const char *s1, const char *s2);
 unsigned long convert_unit(unsigned long value, char *unit);
 int readn(int fd, void *buf, size_t size);