]> git.lizzy.rs Git - plan9front.git/blob - sys/src/libc/port/strpbrk.c
libregexp: improve the transition to next available thread, instruction, and generation
[plan9front.git] / sys / src / libc / port / strpbrk.c
1 #include <u.h>
2 #include <libc.h>
3 #define N       256
4
5 char*
6 strpbrk(char *cs, char *cb)
7 {
8         char map[N];
9         uchar *s=(uchar*)cs, *b=(uchar*)cb;
10
11         memset(map, 0, N);
12         for(;;) {
13                 map[*b] = 1;
14                 if(*b++ == 0)
15                         break;
16         }
17         while(map[*s++] == 0)
18                 ;
19         if(*--s)
20                 return (char*)s;
21         return 0;
22 }