diff options
Diffstat (limited to '')
-rw-r--r-- | src/string/strspn.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/string/strspn.c b/src/string/strspn.c index 511a4bc..1b2e034 100644 --- a/src/string/strspn.c +++ b/src/string/strspn.c @@ -18,9 +18,6 @@ #include <string.h> -# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" - - /** * Returns length of the initial substring @@ -45,54 +42,3 @@ size_t strspn(const char* string, const char* skipset) return (size_t)(s - 1 - string); } - -/** - * Returns length of the initial substring - * that consists entirely of the complement - * of a set of specified bytes. - * - * @param string The string. - * @param stopset Bytes disallowed in the substring. - * @return The length of the substring. - */ -size_t strcspn(const char* string, const char* stopset) -{ - char set[256]; - char c; - const char* s = string; - memset(set, 0, 256); - while ((c = *stopset++)) - set[(size_t)c] = 1; - while ((c = *s++)) - if (!set[(size_t)c]) - break; - return (size_t)(s - 1 - string); -} - - -/** - * This function works like `strcspn`, - * except it returns the pointer to the - * location of the first found non-matching - * byte. - * - * @param string The string. - * @param stopset Bytes disallowed in the substring. - * @return A pointer to the first occurrence in - * `string` of a byte found in `stopset`. - * `NULL` is returned if none is found. - */ -char* (strpbrk)(const char* string, const char* stopset) -{ - char set[256]; - char c; - const char* s = string; - memset(set, 0, 256); - while ((c = *stopset++)) - set[(size_t)c] = 1; - while ((c = *s++)) - if (!set[(size_t)c]) - break; - return c ? (s - 1) : NULL; -} - |