summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-11-29 10:32:56 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-11-29 10:32:56 (GMT)
commitee5f76eeacd881cb235705efa89282157cceeed4 (patch)
tree2d0b4b24895eebe7b99a38c593b4633376d1807a /generic
parentc530770762d3eff1b6450ecedfc1cc3e844fb73b (diff)
downloadtcl-ee5f76eeacd881cb235705efa89282157cceeed4.zip
tcl-ee5f76eeacd881cb235705efa89282157cceeed4.tar.gz
tcl-ee5f76eeacd881cb235705efa89282157cceeed4.tar.bz2
Fix [Bug 1366683]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCmdIL.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 12c3e77..4c83b5f 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdIL.c,v 1.84 2005/11/04 22:38:38 msofer Exp $
+ * RCS: @(#) $Id: tclCmdIL.c,v 1.85 2005/11/29 10:32:56 dkf Exp $
*/
#include "tclInt.h"
@@ -3394,13 +3394,27 @@ Tcl_LsearchObjCmd(clientData, interp, objc, objv)
if ((enum modes) mode == REGEXP) {
/*
* We can shimmer regexp/list if listv[i] == pattern, so get the
- * regexp rep before the list rep.
+ * regexp rep before the list rep. First time round, omit the interp
+ * and hope that the compilation will succeed. If it fails, we'll
+ * recompile in "expensive" mode with a place to put error messages.
*/
- regexp = Tcl_GetRegExpFromObj(interp, objv[objc - 1],
+ regexp = Tcl_GetRegExpFromObj(NULL, objv[objc - 1],
TCL_REG_ADVANCED | TCL_REG_NOSUB |
(noCase ? TCL_REG_NOCASE : 0));
if (regexp == NULL) {
+ /*
+ * Failed to compile the RE. Try again without the TCL_REG_NOSUB
+ * flag in case the RE had sub-expressions in it [Bug 1366683].
+ * If this fails, an error message will be left in the
+ * interpreter.
+ */
+
+ regexp = Tcl_GetRegExpFromObj(interp, objv[objc - 1],
+ TCL_REG_ADVANCED | (noCase ? TCL_REG_NOCASE : 0));
+ }
+
+ if (regexp == NULL) {
if (startPtr != NULL) {
Tcl_DecrRefCount(startPtr);
}