Root/
Source at commit 1808 created 12 years 4 months ago. By blackosx, Revise layout of package installer 'Welcome' file so it looks cleaner. Change the copyright notice to begin from 2009 as seen in the Chameleon 2.0 r431 installer. Should this date be set earlier? | |
---|---|
1 | /*␊ |
2 | * strpbrk␊ |
3 | */␊ |
4 | ␊ |
5 | #include <limits.h>␊ |
6 | #include "libsaio.h"␊ |
7 | #include "strxspn.h"␊ |
8 | ␊ |
9 | ␊ |
10 | ␊ |
11 | ␊ |
12 | size_t __strxspn(const char *s, const char *map, int parity)␊ |
13 | {␊ |
14 | ␉char matchmap[UCHAR_MAX + 1];␊ |
15 | ␉size_t n = 0;␊ |
16 | ␊ |
17 | ␉/* Create bitmap */␊ |
18 | ␉memset(matchmap, 0, sizeof matchmap);␊ |
19 | ␉while (*map)␊ |
20 | ␉␉matchmap[(unsigned char)*map++] = 1;␊ |
21 | ␊ |
22 | ␉/* Make sure the null character never matches */␊ |
23 | ␉matchmap[0] = parity;␊ |
24 | ␊ |
25 | ␉/* Calculate span length */␊ |
26 | ␉while (matchmap[(unsigned char)*s++] ^ parity)␊ |
27 | ␉␉n++;␊ |
28 | ␊ |
29 | ␉return n;␊ |
30 | }␊ |
31 |