summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-11-17 18:12:07 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-11-17 18:12:07 (GMT)
commitfa21483afb1b8a95e33287eaa28f20f0bb319d40 (patch)
treee29fd69d2797dd44088bff0bc55f109b06ea7179 /generic
parent8a337db141701521a51b0fbdeed2ec76f4557129 (diff)
downloadtcl-fa21483afb1b8a95e33287eaa28f20f0bb319d40.zip
tcl-fa21483afb1b8a95e33287eaa28f20f0bb319d40.tar.gz
tcl-fa21483afb1b8a95e33287eaa28f20f0bb319d40.tar.bz2
* generic/regcomp.c: Backported regexp bug fixes and tests. Thanks
* generic/tclTest.c: to Pavel Goran and Vince Darley. * tests/reg.test: [Bugs 230589, 504785, 505048, 703709, 840258]
Diffstat (limited to 'generic')
-rw-r--r--generic/regcomp.c8
-rw-r--r--generic/tclTest.c26
2 files changed, 28 insertions, 6 deletions
diff --git a/generic/regcomp.c b/generic/regcomp.c
index 4aba629..2a7fd6e 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -553,8 +553,12 @@ struct nfa *nfa;
if (b->from != pre)
break;
if (b != NULL) { /* must be split */
- s->tmp = slist;
- slist = s;
+ if (s->tmp == NULL) { /* if not already in the list */
+ /* (fixes bugs 505048, 230589, */
+ /* 840258, 504785) */
+ s->tmp = slist;
+ slist = s;
+ }
}
}
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 3a23941..835c602 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTest.c,v 1.62.2.4 2003/10/31 13:33:40 vincentdarley Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.62.2.5 2003/11/17 18:12:08 dgp Exp $
*/
#define TCL_TEST
@@ -3339,12 +3339,26 @@ TestregexpObjCmd(dummy, interp, objc, objv)
char *varName;
CONST char *value;
int start, end;
- char info[TCL_INTEGER_SPACE * 2];
+ char resinfo[TCL_INTEGER_SPACE * 2];
varName = Tcl_GetString(objv[2]);
TclRegExpRangeUniChar(regExpr, -1, &start, &end);
- sprintf(info, "%d %d", start, end-1);
- value = Tcl_SetVar(interp, varName, info, 0);
+ sprintf(resinfo, "%d %d", start, end-1);
+ value = Tcl_SetVar(interp, varName, resinfo, 0);
+ if (value == NULL) {
+ Tcl_AppendResult(interp, "couldn't set variable \"",
+ varName, "\"", (char *) NULL);
+ return TCL_ERROR;
+ }
+ } else if (cflags & TCL_REG_CANMATCH) {
+ char *varName;
+ CONST char *value;
+ char resinfo[TCL_INTEGER_SPACE * 2];
+
+ Tcl_RegExpGetInfo(regExpr, &info);
+ varName = Tcl_GetString(objv[2]);
+ sprintf(resinfo, "%d", info.extendStart);
+ value = Tcl_SetVar(interp, varName, resinfo, 0);
if (value == NULL) {
Tcl_AppendResult(interp, "couldn't set variable \"",
varName, "\"", (char *) NULL);
@@ -3463,6 +3477,10 @@ TestregexpXflags(string, length, cflagsPtr, eflagsPtr)
cflags &= ~REG_ADVANCED;
break;
}
+ case 'c': {
+ cflags |= TCL_REG_CANMATCH;
+ break;
+ }
case 'e': {
cflags &= ~REG_ADVANCED;
cflags |= REG_EXTENDED;