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.
> 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.
>
>
> Index: ecs.c
> ===
> RCS file: /cvs/src/usr.bin/lex/ecs.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 ecs.c
> --- ecs.c 4 Jun 2003 17:34:44 - 1.6
> +++ ecs.c 12 Oct 2015 14:13:36 -
> @@ -107,9 +107,9 @@ int fwd[], bck[], num;
> /* mkeccl - update equivalence classes based on character class xtions
> *
> * synopsis
> - *Char ccls[];
> + *unsigned char ccls[];
> *int lenccl, fwd[llsiz], bck[llsiz], llsiz, NUL_mapping;
> - *void mkeccl( Char ccls[], int lenccl, int fwd[llsiz], int bck[llsiz],
> + *void mkeccl( unsigned char ccls[], int lenccl, int fwd[llsiz], int
> bck[llsiz],
> * int llsiz, int NUL_mapping );
> *
> * ccls contains the elements of the character class, lenccl is the
> @@ -120,7 +120,7 @@ int fwd[], bck[], num;
> */
>
> void mkeccl( ccls, lenccl, fwd, bck, llsiz, NUL_mapping )
> -Char ccls[];
> +unsigned char ccls[];
> int lenccl, fwd[], bck[], llsiz, NUL_mapping;
> {
> int cclp, oldec, newec;
> Index: flexdef.h
> ===
> RCS file: /cvs/src/usr.bin/lex/flexdef.h,v
> retrieving revision 1.8
> diff -u -p -r1.8 flexdef.h
> --- flexdef.h 10 Oct 2015 05:47:54 - 1.8
> +++ flexdef.h 12 Oct 2015 14:13:36 -
> @@ -81,7 +81,6 @@
>
> /* Always be prepared to generate an 8-bit scanner. */
> #define CSIZE 256
> -#define Char unsigned char
>
> /* Size of input alphabet - should be size of ASCII set. */
> #ifndef DEFAULT_CSIZE
> @@ -633,7 +632,7 @@ extern int end_of_buffer_state;
>
> extern int lastccl, *cclmap, *ccllen, *cclng, cclreuse;
> extern int current_maxccls, current_max_ccl_tbl_size;
> -extern Char *ccltbl;
> +extern unsigned char *ccltbl;
>
>
> /* Variables for miscellaneous information:
> @@ -701,10 +700,10 @@ void flex_free PROTO((void*));
> (char *) reallocate_array( (void *) array, size, sizeof( char ) )
>
> #define allocate_Character_array(size) \
> - (Char *) allocate_array( size, sizeof( Char ) )
> + (unsigned char *) allocate_array( size, sizeof( unsigned char ) )
>
> #define reallocate_Character_array(array,size) \
> - (Char *) reallocate_array( (void *) array, size, sizeof( Char ) )
> + (unsigned char *) reallocate_array( (void *) array, size, sizeof(
> unsigned char ) )
>
>
> /* Used to communicate between scanner and parser. The type should really
> @@ -755,7 +754,7 @@ extern void ccl2ecl PROTO((void));
> extern int cre8ecs PROTO((int[], int[], int));
>
> /* Update equivalence classes based on character class transitions. */
> -extern void mkeccl PROTO((Char[], int, int[], int[], int, int));
> +extern void mkeccl PROTO((unsigned char[], int, int[], int[], int, int));
>
> /* Create equivalence class for single character. */
> extern void mkechar PROTO((int, int[], int[]));
> @@ -834,16 +833,16 @@ extern void bubble PROTO((int [], int));
> extern void check_char PROTO((int c));
>
> /* Replace upper-case letter to lower-case. */
> -extern Char clower PROTO((int));
> +extern unsigned char clower PROTO((int));
>
> /* Returns a dynamically allocated copy of a string. */
> extern char *copy_string PROTO((register const char *));
>
> /* Returns a dynamically allocated copy of a (potentially) unsigned string.
> */
> -extern Char *copy_unsigned_string PROTO((register Char *));
> +extern unsigned char *copy_unsigned_string PROTO((register unsigned char *));
>
> /* Shell sort a character array. */
> -extern void cshell PROTO((Char [], int, int));
> +extern void cshell PROTO((unsigned char[], int, int));
>
> /* Finish up a block of data declarations. */
> extern void dataend PROTO((void));
> @@ -858,7 +857,7 @@ extern void flexerror PROTO((const char[
> extern void flexfatal PROTO((const char[]));
>
> /* Convert a hexadecimal digit string to an integer value. */
> -extern int htoi PROTO((Char[]));
> +extern int htoi PROTO((unsigned char[]));
>
> /* Report an error message formatted with one integer argument. */
> extern void lerrif PROTO((const char[], int));
> @@ -886,10 +885,10 @@ extern void mkdata PROTO((int));/* gene
> extern int myctoi PROTO((char []));
>
> /* Return character corresponding to escape sequence. */
> -extern Char myesc PROTO((Char[]));
> +extern unsigned char myesc PROTO((unsigned char[]));
>
> /* Convert an octal digit string to an integer value. */
> -extern int otoi PROTO((Char [] ));
> +extern int otoi PROTO((unsigned char[] ));
>
> /* Output a