summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/regex/regcomp.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-02-11 21:19:19 +0000
committerCorinna Vinschen <corinna@vinschen.de>2010-02-11 21:19:19 +0000
commit44caccfca243364ea0282a8711ad788e3bc703dc (patch)
treee9e5c3805e68f99154841cf500473f67b2e56dbc /winsup/cygwin/regex/regcomp.c
parent45c8c6469a00491b9f908d0d24a1affe88e0f0e3 (diff)
downloadcygnal-44caccfca243364ea0282a8711ad788e3bc703dc.tar.gz
cygnal-44caccfca243364ea0282a8711ad788e3bc703dc.tar.bz2
cygnal-44caccfca243364ea0282a8711ad788e3bc703dc.zip
* regex/engine.c (step): Drop Cygwin-specific definition.
(NONCHAR): Better cast here to make the test work. Move comment from step here. (matcher): Disable skipping initial string in multibyte case. * regex/regcomp.c (p_bracket): Don't simplify singleton in the invert case. (p_b_term): Handle early end of pattern after dash in bracket expression. (singleton): Don't ignore the wides just because there's already a singleton in the single byte chars. Fix condition for a singleton wide accordingly. (findmust): Check for LC_CTYPE charset, rather than LC_COLLATE charset. * regex2.h (CHIN): Fix condition in the icase & invert case. (ISWORD): Fix wrong cast to unsigned char.
Diffstat (limited to 'winsup/cygwin/regex/regcomp.c')
-rw-r--r--winsup/cygwin/regex/regcomp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/winsup/cygwin/regex/regcomp.c b/winsup/cygwin/regex/regcomp.c
index 721982ab1..a7a48e023 100644
--- a/winsup/cygwin/regex/regcomp.c
+++ b/winsup/cygwin/regex/regcomp.c
@@ -762,7 +762,8 @@ p_bracket(struct parse *p)
if (cs->invert && p->g->cflags&REG_NEWLINE)
cs->bmp['\n' >> 3] |= 1 << ('\n' & 7);
- if ((ch = singleton(cs)) != OUT) { /* optimize singleton sets */
+ if ((ch = singleton(cs)) != OUT /* optimize singleton sets */
+ && cs->invert == 0) { /* But not in invert case. */
ordinary(p, ch);
freeset(p, cs);
} else
@@ -833,6 +834,9 @@ p_b_term(struct parse *p, cset *cs)
finish = '-';
else
finish = p_b_symbol(p);
+ } else if (SEE('-') && !MORE2()) {
+ SETERROR(REG_EBRACK);
+ return;
} else
finish = start;
if (start == finish)
@@ -1212,9 +1216,9 @@ singleton(cset *cs)
n++;
s = i;
}
- if (n == 1)
+ if (n == 1 && cs->nwides == 0)
return (s);
- if (cs->nwides == 1 && cs->nranges == 0 && cs->ntypes == 0 &&
+ if (n == 0 && cs->nwides == 1 && cs->nranges == 0 && cs->ntypes == 0 &&
cs->icase == 0)
return (cs->wides[0]);
/* Don't bother handling the other cases. */
@@ -1467,7 +1471,7 @@ findmust(struct parse *p, struct re_guts *g)
*/
if (MB_CUR_MAX > 1 &&
#ifdef __CYGWIN__
- strcmp(collate_charset, "UTF-8") != 0)
+ strcmp(__locale_charset (), "UTF-8") != 0)
#else
strcmp(_CurrentRuneLocale->__encoding, "UTF-8") != 0)
#endif