receive-pack: move more work into write_head_info()
[git/mjg.git] / ctype.c
blobb5d856fd26bd892a5f18202b054fc53e7c953429
1 /*
2 * Sane locale-independent, ASCII ctype.
4 * No surprises, and works with signed and unsigned chars.
5 */
6 #include "cache.h"
8 enum {
9 S = GIT_SPACE,
10 A = GIT_ALPHA,
11 D = GIT_DIGIT,
12 G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
13 R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
14 P = GIT_PATHSPEC_MAGIC /* other non-alnum, except for ] and } */
17 unsigned char sane_ctype[256] = {
18 0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0, /* 0.. 15 */
19 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16.. 31 */
20 S, P, P, P, R, P, P, P, R, R, G, R, P, P, R, P, /* 32.. 47 */
21 D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G, /* 48.. 63 */
22 P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 64.. 79 */
23 A, A, A, A, A, A, A, A, A, A, A, G, G, 0, R, P, /* 80.. 95 */
24 P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
25 A, A, A, A, A, A, A, A, A, A, A, R, R, 0, P, 0, /* 112..127 */
26 /* Nothing in the 128.. range */