Add (unsigned char) casts to ctype macros

This commit is contained in:
Andrey A. Chernov 1997-10-23 01:43:00 +00:00
parent 92463139ce
commit 8b50620f9a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=30654
2 changed files with 24 additions and 24 deletions

View File

@ -39,23 +39,23 @@ extern void free();
#endif
#ifndef isgraph
#define isgraph(C) (isprint(C) && !isspace(C))
#define isgraph(C) (isprint((unsigned char)C) && !isspace((unsigned char)C))
#endif
#define ISALPHA(C) isalpha(C)
#define ISUPPER(C) isupper(C)
#define ISLOWER(C) islower(C)
#define ISDIGIT(C) isdigit(C)
#define ISXDIGIT(C) isxdigit(C)
#define ISSPACE(C) isspace(C)
#define ISPUNCT(C) ispunct(C)
#define ISALNUM(C) isalnum(C)
#define ISPRINT(C) isprint(C)
#define ISGRAPH(C) isgraph(C)
#define ISCNTRL(C) iscntrl(C)
#define ISALPHA(C) isalpha((unsigned char)C)
#define ISUPPER(C) isupper((unsigned char)C)
#define ISLOWER(C) islower((unsigned char)C)
#define ISDIGIT(C) isdigit((unsigned char)C)
#define ISXDIGIT(C) isxdigit((unsigned char)C)
#define ISSPACE(C) isspace((unsigned char)C)
#define ISPUNCT(C) ispunct((unsigned char)C)
#define ISALNUM(C) isalnum((unsigned char)C)
#define ISPRINT(C) isprint((unsigned char)C)
#define ISGRAPH(C) isgraph((unsigned char)C)
#define ISCNTRL(C) iscntrl((unsigned char)C)
#include "dfa.h"
#include "gnuregex.h"
#include <gnuregex.h>
#if __STDC__
typedef void *ptr_t;
@ -638,9 +638,9 @@ lex()
setbit(c3, ccl);
if (case_fold)
if (ISUPPER(c3))
setbit(tolower(c3), ccl);
setbit(tolower((unsigned char)c3), ccl);
else if (ISLOWER(c3))
setbit(toupper(c3), ccl);
setbit(toupper((unsigned char)c3), ccl);
}
}
#else
@ -649,9 +649,9 @@ lex()
setbit(c, ccl);
if (case_fold)
if (ISUPPER(c))
setbit(tolower(c), ccl);
setbit(tolower((unsigned char)c), ccl);
else if (ISLOWER(c))
setbit(toupper(c), ccl);
setbit(toupper((unsigned char)c), ccl);
++c;
}
#endif
@ -675,10 +675,10 @@ lex()
{
zeroset(ccl);
setbit(c, ccl);
if (isupper(c))
setbit(tolower(c), ccl);
if (isupper((unsigned char)c))
setbit(tolower((unsigned char)c), ccl);
else
setbit(toupper(c), ccl);
setbit(toupper((unsigned char)c), ccl);
return lasttok = CSET + charclass_index(ccl);
}
return c;
@ -1951,7 +1951,7 @@ dfacomp(s, len, d, searchflag)
case_fold = 0;
for (i = 0; i < len; ++i)
if (ISUPPER(s[i]))
copy[i] = tolower(s[i]);
copy[i] = tolower((unsigned char)s[i]);
else
copy[i] = s[i];

View File

@ -50,11 +50,11 @@ extern char *memchr();
#define ISALNUM(C) (isascii(C) && isalnum(C))
#define ISUPPER(C) (isascii(C) && isupper(C))
#else
#define ISALNUM(C) isalnum(C)
#define ISUPPER(C) isupper(C)
#define ISALNUM(C) isalnum((unsigned char)C)
#define ISUPPER(C) isupper((unsigned char)C)
#endif
#define TOLOWER(C) (ISUPPER(C) ? tolower(C) : (C))
#define TOLOWER(C) (ISUPPER(C) ? tolower((unsigned char)C) : (C))
#include "grep.h"
#include "dfa.h"