2005-10-14 02:03:18 +08:00
|
|
|
/*
|
|
|
|
* Sane locale-independent, ASCII ctype.
|
|
|
|
*
|
|
|
|
* No surprises, and works with signed and unsigned chars.
|
|
|
|
*/
|
|
|
|
#include "cache.h"
|
|
|
|
|
2009-01-17 23:50:29 +08:00
|
|
|
enum {
|
|
|
|
S = GIT_SPACE,
|
|
|
|
A = GIT_ALPHA,
|
|
|
|
D = GIT_DIGIT,
|
2009-01-17 23:50:34 +08:00
|
|
|
G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
|
2010-05-14 17:31:35 +08:00
|
|
|
R = GIT_REGEX_SPECIAL /* $, (, ), +, ., ^, {, | */
|
2009-01-17 23:50:29 +08:00
|
|
|
};
|
2005-10-14 02:03:18 +08:00
|
|
|
|
|
|
|
unsigned char sane_ctype[256] = {
|
2009-01-17 23:50:34 +08:00
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0, /* 0.. 15 */
|
2009-01-17 23:50:29 +08:00
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16.. 31 */
|
2009-01-17 23:50:37 +08:00
|
|
|
S, 0, 0, 0, R, 0, 0, 0, R, R, G, R, 0, 0, R, 0, /* 32.. 47 */
|
2009-01-17 23:50:29 +08:00
|
|
|
D, D, D, D, D, D, D, D, D, D, 0, 0, 0, 0, 0, G, /* 48.. 63 */
|
|
|
|
0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */
|
2009-01-17 23:50:37 +08:00
|
|
|
A, A, A, A, A, A, A, A, A, A, A, G, G, 0, R, 0, /* 80.. 95 */
|
2009-01-17 23:50:29 +08:00
|
|
|
0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
|
2009-01-17 23:50:37 +08:00
|
|
|
A, A, A, A, A, A, A, A, A, A, A, R, R, 0, 0, 0, /* 112..127 */
|
2005-10-14 02:03:18 +08:00
|
|
|
/* Nothing in the 128.. range */
|
|
|
|
};
|