Initial import
[sliver-openvswitch.git] / datapath / linux-2.4 / compat-2.4 / string.c
1 /*
2  * Distributed under the terms of the GNU GPL version 2.
3  */
4
5 #include <linux/module.h>
6 #include <linux/string.h>
7
8 #ifndef __HAVE_ARCH_STRCSPN
9 /**
10  * strcspn - Calculate the length of the initial substring of @s which does not contain letters in @reject
11  * @s: The string to be searched
12  * @reject: The string to avoid
13  */
14 size_t strcspn(const char *s, const char *reject)
15 {
16         const char *p;
17         const char *r;
18         size_t count = 0;
19
20         for (p = s; *p != '\0'; ++p) {
21                 for (r = reject; *r != '\0'; ++r) {
22                         if (*p == *r)
23                                 return count;
24                 }
25                 ++count;
26         }
27         return count;
28 }
29 EXPORT_SYMBOL(strcspn);
30 #endif