Theo de Raadt wrote:
> > When scanning for is*() function uses with signed chars, I found that
> > lex(1) uses an unecessary #define for unsigned char. The below diff
> > removes it and fixes an undefined is*() usage or two as well.
>
> Our tree uses lex pretty much as-is from upstream, so this refactoring
> isn't the way to go.
>
> If you find an actual bug however.. fix them, using the established
> practice.
Here are just the bug fixes:
Index: misc.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/misc.c,v
retrieving revision 1.13
diff -u -p -r1.13 misc.c
--- misc.c 27 Oct 2013 18:31:24 -0000 1.13
+++ misc.c 13 Oct 2015 14:30:30 -0000
@@ -109,7 +109,7 @@ char *str;
{
while ( *str )
{
- if ( ! isascii( (Char) *str ) || ! islower( *str ) )
+ if ( ! isascii( (Char) *str ) || ! islower( (unsigned char)
*str ) )
return 0;
++str;
}
@@ -125,7 +125,7 @@ char *str;
{
while ( *str )
{
- if ( ! isascii( (Char) *str ) || ! isupper( *str ) )
+ if ( ! isascii( (Char) *str ) || ! isupper( (unsigned char)
*str ) )
return 0;
++str;
}
@@ -590,7 +590,7 @@ Char array[];
int sptr = 2;
while ( isascii( array[sptr] ) &&
- isxdigit( (char) array[sptr] ) )
+ isxdigit( array[sptr] ) )
/* Don't increment inside loop control
* because if isdigit() is a macro it might
* expand into multiple increments ...