From: Sven Verdoolaege <skimo@xxxxxxxxxx> Signed-off-by: Sven Verdoolaege <skimo@xxxxxxxxxx> --- builtin-name-rev.c | 1 - ctype.c | 5 +++-- git-compat-util.h | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/builtin-name-rev.c b/builtin-name-rev.c index 61eba34..b2ac40c 100644 --- a/builtin-name-rev.c +++ b/builtin-name-rev.c @@ -233,7 +233,6 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix) break; for (p_start = p; *p; p++) { -#define ishex(x) (isdigit((x)) || ((x) >= 'a' && (x) <= 'f')) if (!ishex(*p)) forty = 0; else if (++forty == 40 && diff --git a/ctype.c b/ctype.c index ee06eb7..97b5724 100644 --- a/ctype.c +++ b/ctype.c @@ -6,7 +6,8 @@ #include "cache.h" #define SS GIT_SPACE -#define AA GIT_ALPHA +#define HA GIT_HEXAL +#define AA GIT_OTHAL #define DD GIT_DIGIT unsigned char sane_ctype[256] = { @@ -16,7 +17,7 @@ unsigned char sane_ctype[256] = { 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 */ + 0, HA, HA, HA, HA, HA, HA, 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 */ }; diff --git a/git-compat-util.h b/git-compat-util.h index 362e040..1a36f4c 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -325,12 +325,15 @@ static inline int has_extension(const char *filename, const char *ext) extern unsigned char sane_ctype[256]; #define GIT_SPACE 0x01 #define GIT_DIGIT 0x02 -#define GIT_ALPHA 0x04 +#define GIT_HEXAL 0x04 +#define GIT_OTHAL 0x08 +#define GIT_ALPHA (GIT_HEXAL | GIT_OTHAL) #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0) #define isspace(x) sane_istest(x,GIT_SPACE) #define isdigit(x) sane_istest(x,GIT_DIGIT) #define isalpha(x) sane_istest(x,GIT_ALPHA) #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT) +#define ishex(x) sane_istest(x,GIT_HEXAL | GIT_DIGIT) #define tolower(x) sane_case((unsigned char)(x), 0x20) #define toupper(x) sane_case((unsigned char)(x), 0) -- 1.5.3.rc0.100.ge60b4 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html