From 2904158a955ce9de68ba2adf6f4d208ac0d4d1fb Mon Sep 17 00:00:00 2001 From: hobbs Date: Fri, 7 Dec 2007 21:24:40 +0000 Subject: * generic/tclExecute.c (TclExecuteByteCode INST_REGEXP): * generic/tclCompCmds.c (TclCompileRegexpCmd): Pass correct RE compile flags at compile time, and use TCL_REG_NOSUB. --- ChangeLog | 5 +++-- generic/tclCompCmds.c | 11 +++++++++-- generic/tclExecute.c | 12 ++++-------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05364d0..8d385d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 2007-12-07 Jeff Hobbs - * generic/tclExecute.c (TclExecuteByteCode INST_REGEXP): Use - TCL_REG_NOSUB as we come here without capture vars. + * generic/tclExecute.c (TclExecuteByteCode INST_REGEXP): + * generic/tclCompCmds.c (TclCompileRegexpCmd): Pass correct RE + compile flags at compile time, and use TCL_REG_NOSUB. * generic/tclIOCmd.c (FinalizeIOCmdTSD, Tcl_PutsObjCmd): cache stdout channel object for [puts $str] calls. diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 5f884f6..20acc28 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompCmds.c,v 1.135 2007/12/06 16:36:54 dkf Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.136 2007/12/07 21:24:41 hobbs Exp $ */ #include "tclInt.h" @@ -3191,7 +3191,14 @@ TclCompileRegexpCmd( TclEmitInstInt1(INST_STR_MATCH, nocase, envPtr); } } else { - TclEmitInstInt1(INST_REGEXP, nocase, envPtr); + /* + * Pass correct RE compile flags. We use only Int1 (8-bit), but + * that handles all the flags we want to pass. + * Use TCL_REG_NOSUB as we don't have capture vars. + */ + int cflags = TCL_REG_ADVANCED | TCL_REG_NOSUB + | (nocase ? TCL_REG_NOCASE : 0); + TclEmitInstInt1(INST_REGEXP, cflags, envPtr); } return TCL_OK; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index e537b4b..c8ec537 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.354 2007/12/07 21:08:43 hobbs Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.355 2007/12/07 21:24:41 hobbs Exp $ */ #include "tclInt.h" @@ -4231,19 +4231,15 @@ TclExecuteByteCode( } case INST_REGEXP: { - int nocase, match; + int cflags, match; Tcl_Obj *valuePtr, *value2Ptr; Tcl_RegExp regExpr; - nocase = TclGetInt1AtPtr(pc+1); + cflags = TclGetInt1AtPtr(pc+1); /* RE compile flages like NOCASE */ valuePtr = OBJ_AT_TOS; /* String */ value2Ptr = OBJ_UNDER_TOS; /* Pattern */ - /* - * Use TCL_REG_NOSUB as we come here without capture vars - */ - regExpr = Tcl_GetRegExpFromObj(interp, value2Ptr, - TCL_REG_ADVANCED|TCL_REG_NOSUB|(nocase ? TCL_REG_NOCASE : 0)); + regExpr = Tcl_GetRegExpFromObj(interp, value2Ptr, cflags); if (regExpr == NULL) { match = -1; } else { -- cgit v0.12