diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2009-03-07 14:06:49 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-03-07 11:22:42 -0800 |
commit | c2e9364a06df55e70d7652d37bb4d712f6b3bb3e (patch) | |
tree | c9f3d31ccc36e6729434886ee8eea40034c8bf6b /git-compat-util.h | |
parent | 3d2d4f96d240317d898bd05af567bad938e0bda2 (diff) | |
download | git-c2e9364a06df55e70d7652d37bb4d712f6b3bb3e.tar.gz |
cleanup: add isascii()
Add a standard definition of isascii() and use it to replace an open
coded high-bit test in pretty.c. While we're there, write the ESC
char as the more commonly used '\033' instead of as 0x1b to enhance
its grepability.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index dcf4127750..878d83dd08 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -319,6 +319,7 @@ static inline int has_extension(const char *filename, const char *ext) } /* Sane ctype - no locale, and works with signed chars */ +#undef isascii #undef isspace #undef isdigit #undef isalpha @@ -332,6 +333,7 @@ extern unsigned char sane_ctype[256]; #define GIT_GLOB_SPECIAL 0x08 #define GIT_REGEX_SPECIAL 0x10 #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0) +#define isascii(x) (((x) & ~0x7f) == 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) |