Branch data Line data Source code
1 : : /* 2 : : * Copyright (c) 2019 Peter Bigot Consulting, LLC 3 : : * 4 : : * SPDX-License-Identifier: Apache-2.0 5 : : */ 6 : : 7 : : #include <string.h> 8 : : #include <string.h> 9 : : 10 : : size_t strspn(const char *s, 11 : : const char *accept) 12 : : { 13 : 0 : const char *ins = s; 14 : : 15 [ # # # # ]: 0 : while ((*s != '\0') && (strchr(accept, *s) != NULL)) { 16 : 0 : ++s; 17 : : } 18 : : 19 : 0 : return s - ins; 20 : : } 21 : : 22 : : size_t strcspn(const char *s, 23 : : const char *reject) 24 : : { 25 : 0 : const char *ins = s; 26 : : 27 [ # # # # ]: 0 : while ((*s != '\0') && (strchr(reject, *s) == NULL)) { 28 : 0 : ++s; 29 : : } 30 : : 31 : 0 : return s - ins; 32 : : }