diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-11-17 03:30:10 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-11-17 03:30:10 +0100 |
commit | 5e57b83aae16d44318b9eed1b2cecd0591adc981 (patch) | |
tree | e1cf6290396be7c3251e95606c8a316058ce52a6 /src/string/strspn.c | |
parent | split err.c (diff) | |
download | slibc-5e57b83aae16d44318b9eed1b2cecd0591adc981.tar.gz slibc-5e57b83aae16d44318b9eed1b2cecd0591adc981.tar.bz2 slibc-5e57b83aae16d44318b9eed1b2cecd0591adc981.tar.xz |
m + typo + split (almost all) string/*.c
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/string/strspn.c')
-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; -} - |