X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fregex.c;h=d16bd60381bdf82be7c2203b1bde3916c9de014d;hb=140b7a20b7c376347dac834c95baee91af125394;hp=8aefe49fef15ef2794f9892497c60023ef0e7e7d;hpb=54dce95d144dd483d9d7c3e38ff0a5ed2772809c;p=gnulib.git diff --git a/lib/regex.c b/lib/regex.c index 8aefe49fe..d16bd6038 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -49,11 +49,14 @@ # include #endif +#define WIDE_CHAR_SUPPORT \ + defined _LIBC || (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC) + /* For platform which support the ISO C amendement 1 functionality we support user defined character classes. */ -#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) -# include +#if WIDE_CHAR_SUPPORT # include +# include #endif /* This is for other GNU distributions with internationalized messages. */ @@ -194,6 +197,7 @@ init_syntax_once () Defining isascii to 1 should let any compiler worth its salt eliminate the && through constant folding." */ +#undef ISASCII #if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) # define ISASCII(c) 1 #else @@ -211,6 +215,7 @@ init_syntax_once () # define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c)) #endif +#undef ISPRINT #define ISPRINT(c) (ISASCII (c) && isprint (c)) #define ISDIGIT(c) (ISASCII (c) && isdigit (c)) #define ISALNUM(c) (ISASCII (c) && isalnum (c)) @@ -1201,8 +1206,8 @@ typedef struct if we ever fail back to it. Requires variables fail_stack, regstart, regend, reg_info, and - num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be - declared. + num_regs_pushed be declared. DOUBLE_FAIL_STACK requires `destination' + be declared. Does `return FAILURE_CODE' if runs out of memory. */ @@ -1683,7 +1688,7 @@ typedef struct } \ } -#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) +#if WIDE_CHAR_SUPPORT /* The GNU C library provides support for user-defined character classes and the functions from ISO C amendement 1. */ # ifdef CHARCLASS_NAME_MAX @@ -2183,7 +2188,7 @@ regex_compile (pattern, size, syntax, bufp) the leading `:' and `[' (but set bits for them). */ if (c == ':' && *p == ']') { -#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) +#if WIDE_CHAR_SUPPORT boolean is_lower = STREQ (str, "lower"); boolean is_upper = STREQ (str, "upper"); wctype_t wt; @@ -3092,8 +3097,6 @@ re_compile_fastmap (bufp) #ifndef REGEX_MALLOC char *destination; #endif - /* We don't push any register information onto the failure stack. */ - unsigned num_regs = 0; register char *fastmap = bufp->fastmap; unsigned char *pattern = bufp->buffer;