Skip to content

Commit 80d3c4b

Browse files
authored
Fix strpbrk(). (#376)
1 parent c37e567 commit 80d3c4b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

mos-platform/common/c/string.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,8 @@ __attribute__((weak)) size_t strcspn(const char *s1, const char *s2) {
9797
}
9898

9999
__attribute__((weak)) char *strpbrk(const char *s1, const char *s2) {
100-
while (*s1) {
101-
const char *s1;
102-
for (s1 = s2; *s1 && *s1 != *s1; s1++)
103-
;
104-
if (*s1)
105-
return (char *)s1;
106-
s1++;
107-
}
108-
return (char *)NULL;
100+
s1 += strcspn(s1, s2);
101+
return *s1 ? (char *)s1 : NULL;
109102
}
110103

111104
__attribute__((weak)) char *strrchr(const char *s, int c) {

0 commit comments

Comments
 (0)