summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-02-04 17:34:44 +0000
committerCorinna Vinschen <corinna@vinschen.de>2010-02-04 17:34:44 +0000
commitaec8c3d5104e9b808276bb68d7f35396780b091b (patch)
tree3245248a59a2a1149cec2e582541467143b4a31c
parent4db9544f4f05c139097b8d984aa2e9cfaa499369 (diff)
downloadcygnal-aec8c3d5104e9b808276bb68d7f35396780b091b.tar.gz
cygnal-aec8c3d5104e9b808276bb68d7f35396780b091b.tar.bz2
cygnal-aec8c3d5104e9b808276bb68d7f35396780b091b.zip
* regex/engine.c (step): Declare and define with `int ch' rather than
`wint_t ch' parameter. Explain why. (NONCHAR): Remove related Cygwin patch here, including wrong comment.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/regex/engine.c17
2 files changed, 17 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 12499e1b9..0d28a5b97 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2010-02-04 Corinna Vinschen <corinna@vinschen.de>
+ * regex/engine.c (step): Declare and define with `int ch' rather than
+ `wint_t ch' parameter. Explain why.
+ (NONCHAR): Remove related Cygwin patch here, including wrong comment.
+
+2010-02-04 Corinna Vinschen <corinna@vinschen.de>
+
Replace regex files with multibyte-aware version from FreeBSD.
* Makefile.in (install-headers): Remove extra command to install
regex.h.
diff --git a/winsup/cygwin/regex/engine.c b/winsup/cygwin/regex/engine.c
index ca24cc50c..a517a67ee 100644
--- a/winsup/cygwin/regex/engine.c
+++ b/winsup/cygwin/regex/engine.c
@@ -106,7 +106,11 @@ static const char *dissect(struct match *m, const char *start, const char *stop,
static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev, int);
static const char *fast(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
static const char *slow(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+#ifdef __CYGWIN__
+static states step(struct re_guts *g, sopno start, sopno stop, states bef, int ch, states aft);
+#else
static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft);
+#endif
#define MAX_RECURSION 100
#define BOL (OUT-1)
#define EOL (BOL-1)
@@ -115,13 +119,7 @@ static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_
#define BOW (BOL-4)
#define EOW (BOL-5)
#define BADCHAR (BOL-6)
-#ifdef __CYGWIN__
-/* In contrast to BSD, wint_t on Cygwin is unsigned. This breaks this test,
- unless the compared values are casted to signed. */
-#define NONCHAR(c) ((int)(c) <= (int)OUT)
-#else
#define NONCHAR(c) ((c) <= OUT)
-#endif
#ifdef REDEBUG
static void print(struct match *m, const char *caption, states st, int ch, FILE *d);
#endif
@@ -995,7 +993,14 @@ step(struct re_guts *g,
sopno start, /* start state within strip */
sopno stop, /* state after stop state within strip */
states bef, /* states reachable before */
+#ifdef __CYGWIN__
+ /* When using wint_t, which is defined as unsigned int on BSD,
+ as well as on Cygwin or Linux, the NONCHAR test is broken.
+ I'm wondering how this is supposed to work at all... */
+ int ch, /* character or NONCHAR code */
+#else
wint_t ch, /* character or NONCHAR code */
+#endif
states aft) /* states already known reachable after */
{
cset *cs;