Root/
Source at commit 658 created 13 years 5 months ago. By meklort, Makeful update (again). Added a ugly hack so that only c++ modules will link agains the uClibc++ module. Removed the possibility for modules to link agains themselfs. Added laxydylib1.c so that if you try to compile a module with -lazy_library instead of -weak_library, the build will not fail | |
---|---|
1 | /*␊ |
2 | * strpbrk␊ |
3 | */␊ |
4 | ␊ |
5 | #include <string.h>␊ |
6 | #include <stddef.h>␊ |
7 | #include <inttypes.h>␊ |
8 | #include <limits.h>␊ |
9 | #include "strxspn.h"␊ |
10 | ␊ |
11 | size_t __strxspn(const char *s, const char *map, int parity)␊ |
12 | {␊ |
13 | ␉char matchmap[UCHAR_MAX + 1];␊ |
14 | ␉size_t n = 0;␊ |
15 | ␊ |
16 | ␉/* Create bitmap */␊ |
17 | ␉memset(matchmap, 0, sizeof matchmap);␊ |
18 | ␉while (*map)␊ |
19 | ␉␉matchmap[(unsigned char)*map++] = 1;␊ |
20 | ␊ |
21 | ␉/* Make sure the null character never matches */␊ |
22 | ␉matchmap[0] = parity;␊ |
23 | ␊ |
24 | ␉/* Calculate span length */␊ |
25 | ␉while (matchmap[(unsigned char)*s++] ^ parity)␊ |
26 | ␉␉n++;␊ |
27 | ␊ |
28 | ␉return n;␊ |
29 | }␊ |
30 |