From 5e57b83aae16d44318b9eed1b2cecd0591adc981 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 17 Nov 2015 03:30:10 +0100 Subject: m + typo + split (almost all) string/*.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/string/strspn.c | 54 ----------------------------------------------------- 1 file changed, 54 deletions(-) (limited to 'src/string/strspn.c') 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 -# 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; -} - -- cgit v1.2.3-70-g09d2