diff --git a/src/configure.in b/src/configure.in index 0c580304333ccd9f81ef81a271cf5674f5aba1cc..e5428419d595f930168060934da3bffe2b82e40b 100644 --- a/src/configure.in +++ b/src/configure.in @@ -6024,16 +6024,6 @@ char buf[100]; ######################################################################## -MY_CHECK_FUNCTION(isspace, -[ -#include <ctype.h> -], [ - if(isspace(' ')) exit(0); - exit(1); -]) - -############################################################################# - AC_MSG_CHECKING(if we can declare environ) AC_CACHE_VAL(pike_cv_declare_environ,[ AC_TRY_COMPILE([ diff --git a/src/lexer.h b/src/lexer.h index 1fd479bbfa05cb8e510b583078a320b67de93ef3..6b33e4376ef4a99b09930172a5eb37256593f022 100644 --- a/src/lexer.h +++ b/src/lexer.h @@ -21,8 +21,8 @@ /* Generic */ #define GOBBLE(c) (LOOK()==c?(SKIP(),1):0) -#define SKIPSPACE() do { while(ISSPACE(LOOK()) && LOOK()!='\n') SKIP(); }while(0) -#define SKIPWHITE() do { while(ISSPACE(LOOK())) SKIP(); }while(0) +#define SKIPSPACE() do { while(isspace(LOOK()) && LOOK()!='\n') SKIP(); }while(0) +#define SKIPWHITE() do { while(isspace(LOOK())) SKIP(); }while(0) #define SKIPUPTO(X) do { while(LOOK()!=(X) && LOOK()) SKIP(); }while(0) #if (SHIFT == 0) @@ -982,7 +982,7 @@ unknown_directive: SHIFT); dmalloc_touch_svalue(&sval); if ((TYPEOF(sval) == PIKE_T_INT) && (p3 > p2)) { - for (l=0; ISSPACE(INDEX_CHARP(p3, l, SHIFT)); l++) + for (l=0; isspace(INDEX_CHARP(p3, l, SHIFT)); l++) ; if ((INDEX_CHARP(p3, l, SHIFT) == ':') && (INDEX_CHARP(p3, l+1, SHIFT) == ':')) { diff --git a/src/modules/Image/encodings/pnm.c b/src/modules/Image/encodings/pnm.c index 7b641fcbd70ab5df80e6ad1ee3361773aa9ef17c..bd336b4e65c1783c114014d189fdc61b7cc63815 100644 --- a/src/modules/Image/encodings/pnm.c +++ b/src/modules/Image/encodings/pnm.c @@ -75,7 +75,7 @@ static INLINE unsigned char getnext(struct pike_string *s,INT32 *pos) { if (*pos>=s->len) return 0; if (s->str[(*pos)]=='#') - for (;*pos<s->len && ISSPACE(((unsigned char *)(s->str))[*pos]);(*pos)++); + for (;*pos<s->len && isspace(((unsigned char *)(s->str))[*pos]);(*pos)++); return s->str[(*pos)++]; } @@ -95,7 +95,7 @@ static INLINE unsigned char getnext_skip_comment(struct pike_string *s,INT32 *po static INLINE void skipwhite(struct pike_string *s,INT32 *pos) { while (*pos<s->len && - ( ISSPACE(((unsigned char *)(s->str))[*pos]) || + ( isspace(((unsigned char *)(s->str))[*pos]) || s->str[*pos]=='#')) getnext_skip_comment(s,pos); } diff --git a/src/pike_types.c b/src/pike_types.c index 4c887f380f7f2f5831e8f8e7f6ff28e42c2a427d..b7f2bc639759e1f9f281f9b208dfde01cdaed315 100644 --- a/src/pike_types.c +++ b/src/pike_types.c @@ -1390,7 +1390,7 @@ static struct pike_string *internal_parse_type_string(const char **_s) const unsigned char **s = (const unsigned char **)_s; const unsigned char *p; struct string_builder tmp; - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s != '\"') yyerror("Expected '\"'."); else ++*s; @@ -1429,7 +1429,7 @@ static void internal_parse_typeA(const char **_s) unsigned int len; const unsigned char **s = (const unsigned char **)_s; - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; for(len=0;isidchar(EXTRACT_UCHAR(s[0]+len));len++) { @@ -1453,15 +1453,15 @@ static void internal_parse_typeA(const char **_s) case 'i': if(!strcmp(buf,"int")) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s=='(') { INT32 min,max; ++*s; - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if (**s != '.') { min=STRTOL((const char *)*s,(char **)s,0); - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; } else { min = MIN_INT32; } @@ -1471,10 +1471,10 @@ static void internal_parse_typeA(const char **_s) yyerror("Missing .. in integer type."); } - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if (**s != ')') { max=STRTOL((const char *)*s,(char **)s,0); - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; } else { max = MAX_INT32; } @@ -1493,12 +1493,12 @@ static void internal_parse_typeA(const char **_s) case 'f': if(!strcmp(buf,"function")) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s == '(') { int nargs = 0; ++*s; - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; while(1) { if(**s == ':') @@ -1511,12 +1511,12 @@ static void internal_parse_typeA(const char **_s) { nargs++; ++*s; - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; } else if(s[0][0]=='.' && s[0][1]=='.' && s[0][2]=='.') { *s+=3; - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s != ':') { yyerror("Missing ':' after ... in function type."); --*s; @@ -1555,12 +1555,12 @@ static void internal_parse_typeA(const char **_s) case 'o': if(!strcmp(buf,"object")) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s == '(') /* object({,is,implements} {id,this_program}) */ { int is = 0, id; ++*s; - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if( **s != 'i' ) goto no_is_implements; ++*s; @@ -1577,7 +1577,7 @@ static void internal_parse_typeA(const char **_s) } *s += 10; } - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; no_is_implements: if( !**s ) goto bad_type; @@ -1589,7 +1589,7 @@ static void internal_parse_typeA(const char **_s) while( **s >= '0' && **s <= '9' ) ++*s; } - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if( !**s || **s != ')' ) goto bad_type; ++*s; @@ -1613,15 +1613,15 @@ static void internal_parse_typeA(const char **_s) case 's': if(!strcmp(buf,"string")) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s == '(') { INT32 min,max; ++*s; - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if (**s != '.') { min=STRTOL((const char *)*s,(char **)s,0); - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; } else { min = MIN_INT32; } @@ -1631,10 +1631,10 @@ static void internal_parse_typeA(const char **_s) yyerror("Missing .. in integer type."); } - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if (**s != ')') { max=STRTOL((const char *)*s,(char **)s,0); - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; } else { max = MAX_INT32; } @@ -1657,7 +1657,7 @@ static void internal_parse_typeA(const char **_s) case 't': if (!strcmp(buf,"tuple")) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s == '(') { ++*s; @@ -1684,7 +1684,7 @@ static void internal_parse_typeA(const char **_s) if(!strcmp(buf,"mixed")) { push_type(T_MIXED); break; } if(!strcmp(buf,"mapping")) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s == '(') { ++*s; @@ -1705,7 +1705,7 @@ static void internal_parse_typeA(const char **_s) } if(!strcmp(buf,"multiset")) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s == '(') { ++*s; @@ -1728,7 +1728,7 @@ static void internal_parse_typeA(const char **_s) case 'a': if(!strcmp(buf,"array")) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s == '(') { ++*s; @@ -1746,13 +1746,13 @@ static void internal_parse_typeA(const char **_s) case '_': if (!strcmp(buf, "__attribute__")) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s == '(') { struct pike_string *attr; ++*s; attr = internal_parse_type_string(_s); - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s != ',') yyerror("Expected ','."); else ++*s; @@ -1769,7 +1769,7 @@ static void internal_parse_typeA(const char **_s) } else if (!strcmp(buf, "__deprecated__")) { struct pike_string *deprecated_string; MAKE_CONST_STRING(deprecated_string, "deprecated"); - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s == '(') { ++*s; @@ -1798,7 +1798,7 @@ static void internal_parse_typeA(const char **_s) case '9': if(atoi(buf)<10) { - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; if(**s=='=') { ++*s; @@ -1816,13 +1816,13 @@ static void internal_parse_typeA(const char **_s) my_yyerror("Couldn't parse type. (%s).", buf); } - while(ISSPACE(**s)) ++*s; + while(isspace(**s)) ++*s; } static void internal_parse_typeB(const char **s) { - while(ISSPACE(EXTRACT_UCHAR(*s))) ++*s; + while(isspace(EXTRACT_UCHAR(*s))) ++*s; switch(**s) { case '!': @@ -1834,7 +1834,7 @@ static void internal_parse_typeB(const char **s) case '(': ++*s; internal_parse_type(s); - while(ISSPACE(EXTRACT_UCHAR(*s))) ++*s; + while(isspace(EXTRACT_UCHAR(*s))) ++*s; if(**s != ')') { yyerror("Expected ')' in type."); } @@ -1851,12 +1851,12 @@ static void internal_parse_typeCC(const char **s) { internal_parse_typeB(s); - while(ISSPACE(EXTRACT_UCHAR(*s))) ++*s; + while(isspace(EXTRACT_UCHAR(*s))) ++*s; while(**s == '*') { ++*s; - while(ISSPACE(EXTRACT_UCHAR(*s))) ++*s; + while(isspace(EXTRACT_UCHAR(*s))) ++*s; push_type(T_ARRAY); } } diff --git a/src/port.c b/src/port.c index 8374d8419f23373c340f38c467d28b09cad2455c..fb5d466b2064451fdd054238eaf5125f50580685 100644 --- a/src/port.c +++ b/src/port.c @@ -34,18 +34,6 @@ #include <string.h> #include <time.h> -#ifndef HAVE_ISSPACE -PMOD_EXPORT const char Pike_isspace_vector[] = - "0012345678SSSSS456789012345678901" - "S3456789012345678901234567890123" - "45678901234567890123456789012345" - "67890123456789012345678901234567" - "89012345678901234567890123456789" - "01234567890123456789012345678901" - "23456789012345678901234567890123" - "45678901234567890123456789000000"; -#endif - #ifdef sun time_t time PROT((time_t *)); #endif @@ -284,7 +272,7 @@ PMOD_EXPORT long STRTOL(const char *str, char **ptr, int base) if (base < 0 || base > MBASE) return 0; /* base is invalid -- should be a fatal error */ if (!isalnum(c = *str & 0xff)) { - while (ISSPACE(c)) + while (isspace(c)) c = *++str & 0xff; switch (c) { case '-': @@ -472,7 +460,7 @@ PMOD_EXPORT double STRTOD(const char * nptr, char **endptr) s = (const unsigned char *)nptr; /* Eat whitespace. */ - while (ISSPACE(*s)) ++s; + while (isspace(*s)) ++s; /* Get the sign. */ sign = *s == '-' ? -1 : 1; @@ -536,7 +524,7 @@ PMOD_EXPORT double STRTOD(const char * nptr, char **endptr) /* NOTE: Don't trust the value returned from STRTOL. * We need to find the sign of the exponent by hand. */ - while(ISSPACE(*s)) { + while(isspace(*s)) { s++; } if (endptr != NULL) diff --git a/src/port.h b/src/port.h index cf8b5875e28c9a173ab80d074ed3afb4e4a19518..f984ecbcb385619e5144de456095d3aa510a6c4b 100644 --- a/src/port.h +++ b/src/port.h @@ -103,18 +103,14 @@ struct timeval; #endif -#ifdef HAVE_ISSPACE +#define HAVE_ISSPACE 1 #define ISSPACE(X) isspace(X) -#else -PMOD_EXPORT extern const char Pike_isspace_vector[]; -#define ISSPACE(X) (Pike_isspace_vector[(X)+1] == 'S') -#endif /* Warning, these run 'C' more than once */ /* FIXME: Is it that great that every wide char is considered an * identifier char? Doesn't strike me as very unicode compliant. * isalnum, isdigit and islower also look seriously borken. /mast */ -#define WIDE_ISSPACE(C) (((C) < 256)?ISSPACE(C):0) +#define WIDE_ISSPACE(C) (((C) < 256)?isspace(C):0) #define WIDE_ISIDCHAR(C) (((C) < 256)?isidchar(C):1) #define WIDE_ISALNUM(C) (((C) < 256)?isalnum(C):0) #define WIDE_ISDIGIT(C) (((C) < 256)?isdigit(C):0)