mirror of
https://github.com/git/git.git
synced 2024-11-27 20:14:30 +08:00
c841aa8b90
Enhance the readability of ctype.c by using an enum instead of macros to initialize the character class table. This allows the use of a single letter to mark a char, making the table fit within 80 columns. Also list the index of the last entry in each row in the following comment. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
26 lines
820 B
C
26 lines
820 B
C
/*
|
|
* Sane locale-independent, ASCII ctype.
|
|
*
|
|
* No surprises, and works with signed and unsigned chars.
|
|
*/
|
|
#include "cache.h"
|
|
|
|
enum {
|
|
S = GIT_SPACE,
|
|
A = GIT_ALPHA,
|
|
D = GIT_DIGIT,
|
|
G = GIT_SPECIAL, /* \0, *, ?, [, \\ */
|
|
};
|
|
|
|
unsigned char sane_ctype[256] = {
|
|
G, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0, /* 0.. 15 */
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16.. 31 */
|
|
S, 0, 0, 0, 0, 0, 0, 0, 0, 0, G, 0, 0, 0, 0, 0, /* 32.. 47 */
|
|
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 */
|
|
A, A, A, A, A, A, A, A, A, A, A, G, G, 0, 0, 0, /* 80.. 95 */
|
|
0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, /* 96..111 */
|
|
A, A, A, A, A, A, A, A, A, A, A, 0, 0, 0, 0, 0, /* 112..127 */
|
|
/* Nothing in the 128.. range */
|
|
};
|