@@ -463,6 +463,8 @@ static inline int has_extension(const char *filename, const char *ext)
463
463
#undef isdigit
464
464
#undef isalpha
465
465
#undef isalnum
466
+ #undef islower
467
+ #undef isupper
466
468
#undef tolower
467
469
#undef toupper
468
470
extern unsigned char sane_ctype [256 ];
@@ -478,6 +480,8 @@ extern unsigned char sane_ctype[256];
478
480
#define isdigit (x ) sane_istest(x,GIT_DIGIT)
479
481
#define isalpha (x ) sane_istest(x,GIT_ALPHA)
480
482
#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)
481
485
#define is_glob_special (x ) sane_istest(x,GIT_GLOB_SPECIAL)
482
486
#define is_regex_special (x ) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
483
487
#define tolower (x ) sane_case((unsigned char)(x), 0x20)
@@ -491,6 +495,17 @@ static inline int sane_case(int x, int high)
491
495
return x ;
492
496
}
493
497
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
+
494
509
static inline int strtoul_ui (char const * s , int base , unsigned int * result )
495
510
{
496
511
unsigned long ul ;
0 commit comments