@@ -463,6 +463,8 @@ static inline int has_extension(const char *filename, const char *ext)
463463#undef isdigit
464464#undef isalpha
465465#undef isalnum
466+ #undef islower
467+ #undef isupper
466468#undef tolower
467469#undef toupper
468470extern unsigned char sane_ctype [256 ];
@@ -478,6 +480,8 @@ extern unsigned char sane_ctype[256];
478480#define isdigit (x ) sane_istest(x,GIT_DIGIT)
479481#define isalpha (x ) sane_istest(x,GIT_ALPHA)
480482#define isalnum (x ) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
483+ #define islower (x ) sane_iscase(x, 1)
484+ #define isupper (x ) sane_iscase(x, 0)
481485#define is_glob_special (x ) sane_istest(x,GIT_GLOB_SPECIAL)
482486#define is_regex_special (x ) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
483487#define tolower (x ) sane_case((unsigned char)(x), 0x20)
@@ -491,6 +495,17 @@ static inline int sane_case(int x, int high)
491495 return x ;
492496}
493497
498+ static inline int sane_iscase (int x , int is_lower )
499+ {
500+ if (!sane_istest (x , GIT_ALPHA ))
501+ return 0 ;
502+
503+ if (is_lower )
504+ return (x & 0x20 ) != 0 ;
505+ else
506+ return (x & 0x20 ) == 0 ;
507+ }
508+
494509static inline int strtoul_ui (char const * s , int base , unsigned int * result )
495510{
496511 unsigned long ul ;
0 commit comments