123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #include <string.h>
- #ifdef _TLIBC_USE_INTEL_FAST_STRING_
- extern size_t _intel_fast_strcspn(const char *, const char *);
- #endif
- size_t
- __strcspn(const char *s1, const char *s2)
- {
- const char *p, *spanp;
- char c, sc;
-
- for (p = s1;;) {
- c = *p++;
- spanp = s2;
- do {
- if ((sc = *spanp++) == c)
- return (p - 1 - s1);
- } while (sc != 0);
- }
-
- }
- size_t
- strcspn(const char *s1, const char *s2)
- {
- #ifdef _TLIBC_USE_INTEL_FAST_STRING_
- return _intel_fast_strcspn(s1, s2);
- #else
- return __strcspn(s1, s2);
- #endif
- }
|