summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-11-29 10:32:30 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-11-29 10:32:30 (GMT)
commitd8635a48cf1f669a2c8103dacc8a93e3e3269b87 (patch)
treefd58b66c165407add33b851463c430b406df7bea /generic
parent2c6f5f96ac3e2cd2f9d6a94d2df7d40ad2e81c90 (diff)
downloadtcl-d8635a48cf1f669a2c8103dacc8a93e3e3269b87.zip
tcl-d8635a48cf1f669a2c8103dacc8a93e3e3269b87.tar.gz
tcl-d8635a48cf1f669a2c8103dacc8a93e3e3269b87.tar.bz2
Fix [Bug 1366683]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCmdIL.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index f38011b..7a232a6 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -15,7 +15,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.47.2.7 2005/10/23 22:01:29 msofer Exp $
+ * RCS: @(#) $Id: tclCmdIL.c,v 1.47.2.8 2005/11/29 10:32:31 dkf Exp $
*/
#include "tclInt.h"
@@ -3017,11 +3017,26 @@ 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);
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);
+ }
+
+ if (regexp == NULL) {
if (startPtr) {
Tcl_DecrRefCount(startPtr);
}