Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/modules/klibc/strxspn.c

Source at commit 690 created 13 years 3 months ago.
By meklort, Compiles again. Only tested with Xcode 4.
1/*
2 * strpbrk
3 */
4
5#include <limits.h>
6#include "strxspn.h"
7
8
9
10
11size_t __strxspn(const char *s, const char *map, int parity)
12{
13char matchmap[UCHAR_MAX + 1];
14size_t n = 0;
15
16/* Create bitmap */
17memset(matchmap, 0, sizeof matchmap);
18while (*map)
19matchmap[(unsigned char)*map++] = 1;
20
21/* Make sure the null character never matches */
22matchmap[0] = parity;
23
24/* Calculate span length */
25while (matchmap[(unsigned char)*s++] ^ parity)
26n++;
27
28return n;
29}
30

Archive Download this file

Revision: 690