Chameleon

Chameleon Svn Source Tree

Root/branches/slice/old749m/i386/modules/klibc/strxspn.c

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

Archive Download this file

Revision: 1174