diff options
author | hobbs <hobbs> | 2001-08-07 00:51:12 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2001-08-07 00:51:12 (GMT) |
commit | 48ae72be11de3a91bee0e85531e7f9c25d921287 (patch) | |
tree | c8a1a9bdcb943b8abc2999b517a26255571b6de8 | |
parent | add60805e64260e099001e7d1da305ecedd74d68 (diff) | |
download | tcl-48ae72be11de3a91bee0e85531e7f9c25d921287.zip tcl-48ae72be11de3a91bee0e85531e7f9c25d921287.tar.gz tcl-48ae72be11de3a91bee0e85531e7f9c25d921287.tar.bz2 |
* generic/tclCmdMZ.c (Tcl_RegexpObjCmd, Tcl_RegsubObjCmd):
reordered the retrieval of arguments to avoid shimmering bug when
the pattern and string referenced the same object.
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 36 |
2 files changed, 40 insertions, 15 deletions
@@ -1,3 +1,22 @@ +2001-08-06 Jeff Hobbs <jeffh@ActiveState.com> + + * generic/tclCmdMZ.c (Tcl_RegexpObjCmd, Tcl_RegsubObjCmd): + reordered the retrieval of arguments to avoid shimmering bug when + the pattern and string referenced the same object. + + * unix/configure: regenerated + * unix/tcl.m4: added GNU (HURD) configuration target. (brinkmann) + [Patch: #442974] + +2001-08-03 Jeff Hobbs <jeffh@ActiveState.com> + + * win/configure: regenerated + * win/tcl.m4: fixed DLLSUFFIX definition to always be ${DBGX}.dll. + This is necessary for TEA compliant builds that build shared + against a static-built Tcl. + * win/Makefile.in ($(TCLSH)): added $(TCL_STUB_LIB_FILE) to build + target, otherwise it wouldn't get generated in a static build. + 2001-08-06 Andreas Kupries <andreas_kupries@users.sourceforge.net> * generic/tclIOCmd.c (Tcl_GetsObjCmd): Applied patch from SF item diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 5695702..f8798c5 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.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: tclCmdMZ.c,v 1.26.2.1 2001/04/03 22:54:36 hobbs Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.26.2.2 2001/08/07 00:51:12 hobbs Exp $ */ #include "tclInt.h" @@ -149,7 +149,7 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv) offset = 0; all = 0; doinline = 0; - + for (i = 1; i < objc; i++) { char *name; int index; @@ -235,11 +235,18 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv) return TCL_ERROR; } + /* + * Get the length of the string that we are matching against so + * we can do the termination test for -all matches. Do this before + * getting the regexp to avoid shimmering problems. + */ + objPtr = objv[1]; + stringLength = Tcl_GetCharLength(objPtr); + regExpr = Tcl_GetRegExpFromObj(interp, objv[0], cflags); if (regExpr == NULL) { return TCL_ERROR; } - objPtr = objv[1]; if (about) { if (TclRegAbout(interp, regExpr) < 0) { @@ -275,12 +282,6 @@ Tcl_RegexpObjCmd(dummy, interp, objc, objv) } /* - * Get the length of the string that we are matching against so - * we can do the termination test for -all matches. - */ - stringLength = Tcl_GetCharLength(objPtr); - - /* * The following loop is to handle multiple matches within the * same source string; each iteration handles one match. If "-all" * hasn't been specified then the loop body only gets executed once. @@ -530,6 +531,17 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv) objv += i; + /* + * Get the length of the string that we are matching before + * getting the regexp to avoid shimmering problems. + */ + + objPtr = objv[1]; + wlen = Tcl_GetCharLength(objPtr); + wstring = Tcl_GetUnicode(objPtr); + subspec = Tcl_GetString(objv[2]); + varPtr = objv[3]; + regExpr = Tcl_GetRegExpFromObj(interp, objv[0], cflags); if (regExpr == NULL) { return TCL_ERROR; @@ -539,12 +551,6 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv) resultPtr = Tcl_NewObj(); Tcl_IncrRefCount(resultPtr); - objPtr = objv[1]; - wlen = Tcl_GetCharLength(objPtr); - wstring = Tcl_GetUnicode(objPtr); - subspec = Tcl_GetString(objv[2]); - varPtr = objv[3]; - /* * The following loop is to handle multiple matches within the * same source string; each iteration handles one match and its |