--- a/lib/malloc.c +++ b/lib/malloc.c @@ -1,9 +1,9 @@ #include #undef malloc - #include + #include - void *malloc (); + #include /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ --- a/src/flexdef.h +++ b/src/flexdef.h @@ -38,6 +38,14 @@ #ifdef HAVE_CONFIG_H #include #endif + +#include +#ifdef malloc +void *malloc(size_t); +#endif +#ifdef realloc +void *realloc(void *, size_t); +#endif #include #include @@ -76,6 +84,8 @@ /* Required: strcasecmp() in */ #include #include "flexint.h" + +#define flex_isascii(c) (((unsigned int) (c)) <= 0x7f) /* We use gettext. So, when we write strings which should be translated, we mark them with _() */ #ifdef ENABLE_NLS @@ -1078,7 +1088,7 @@ /* ctype functions forced to return boolean */ #define b_isalnum(c) (isalnum(c)?true:false) #define b_isalpha(c) (isalpha(c)?true:false) -#define b_isascii(c) (isascii(c)?true:false) +#define b_isascii(c) (flex_isascii(c)?true:false) #define b_isblank(c) (isblank(c)?true:false) #define b_iscntrl(c) (iscntrl(c)?true:false) #define b_isdigit(c) (isdigit(c)?true:false) --- a/src/misc.c +++ b/src/misc.c @@ -163,7 +163,7 @@ int all_lower (char *str) { while (*str) { - if (!isascii ((unsigned char) * str) || !islower ((unsigned char) * str)) + if (!flex_isascii ((unsigned char) * str) || !islower ((unsigned char) * str)) return 0; ++str; } @@ -177,7 +177,7 @@ int all_upper (char *str) { while (*str) { - if (!isascii ((unsigned char) * str) || !isupper ((unsigned char) * str)) + if (!flex_isascii ((unsigned char) * str) || !isupper ((unsigned char) * str)) return 0; ++str; } @@ -217,7 +217,7 @@ unsigned char clower (int c) { - return (unsigned char) ((isascii (c) && isupper (c)) ? tolower (c) : c); + return (unsigned char) ((flex_isascii (c) && isupper (c)) ? tolower (c) : c); } --- a/src/yylex.c +++ b/src/yylex.c @@ -151,7 +151,7 @@ break; default: - if (!isascii (yylval) || !isprint (yylval)) { + if (!flex_isascii (yylval) || !isprint (yylval)) { if(trace_hex) fprintf (stderr, "\\x%02x", (unsigned int) yylval); else --- a/src/parse.y +++ b/src/parse.y @@ -88,7 +88,7 @@ do{ \ int c; \ for ( c = 0; c < csize; ++c ) \ - if ( isascii(c) && func(c) ) \ + if ( flex_isascii(c) && func(c) ) \ ccladd( currccl, c ); \ }while(0) --- a/src/parse.c +++ b/src/parse.c @@ -120,7 +120,7 @@ do{ \ int c; \ for ( c = 0; c < csize; ++c ) \ - if ( isascii(c) && func(c) ) \ + if ( flex_isascii(c) && func(c) ) \ ccladd( currccl, c ); \ }while(0)