diff options
author | Linus Torvalds <torvalds@osdl.org> | 2005-10-13 11:03:18 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-10-14 17:17:27 -0700 |
commit | 4546738b58a0134eef154231b07d60fc174d56e3 (patch) | |
tree | 873d8e5652c06c3891278f33546c437efc209c2d /ctype.c | |
parent | d402d5566fdf226697a386dfb9858e5d954e9b91 (diff) | |
download | git-4546738b58a0134eef154231b07d60fc174d56e3.tar.gz |
Unlocalized isspace and friends
Do our own ctype.h, just to get the sane semantics: we want
locale-independence, _and_ we want the right signed behaviour. Plus we
only use a very small subset of ctype.h anyway (isspace, isalpha,
isdigit and isalnum).
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'ctype.c')
-rw-r--r-- | ctype.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ctype.c b/ctype.c new file mode 100644 index 0000000000..56bdffa636 --- /dev/null +++ b/ctype.c @@ -0,0 +1,23 @@ +/* + * Sane locale-independent, ASCII ctype. + * + * No surprises, and works with signed and unsigned chars. + */ +#include "cache.h" + +#define SS GIT_SPACE +#define AA GIT_ALPHA +#define DD GIT_DIGIT + +unsigned char sane_ctype[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, SS, SS, 0, 0, SS, 0, 0, /* 0-15 */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16-15 */ + SS, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 32-15 */ + DD, DD, DD, DD, DD, DD, DD, DD, DD, DD, 0, 0, 0, 0, 0, 0, /* 48-15 */ + 0, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, /* 64-15 */ + AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, 0, 0, 0, 0, 0, /* 80-15 */ + 0, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, /* 96-15 */ + AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, AA, 0, 0, 0, 0, 0, /* 112-15 */ + /* Nothing in the 128.. range */ +}; + |