diff options
author | hobbs <hobbs> | 2002-02-27 06:39:26 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-02-27 06:39:26 (GMT) |
commit | b8243a4158d130a28312c6e3f5475855f48ed2dc (patch) | |
tree | 5bc7f593bb3bcaeae6b899706b2bd10b20b38b28 /generic/tclCmdMZ.c | |
parent | c41330c9d6c97ddc3237c3216c6ea5c543893bfb (diff) | |
download | tcl-b8243a4158d130a28312c6e3f5475855f48ed2dc.zip tcl-b8243a4158d130a28312c6e3f5475855f48ed2dc.tar.gz tcl-b8243a4158d130a28312c6e3f5475855f48ed2dc.tar.bz2 |
generic/tclCmdMZ.c
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r-- | generic/tclCmdMZ.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 04c6a6c..d78e29c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.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: tclCmdMZ.c,v 1.61 2002/02/22 14:52:45 dkf Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.62 2002/02/27 06:39:26 hobbs Exp $ */ #include "tclInt.h" @@ -584,14 +584,16 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv) * regsub behavior for "" matches between each character. * 'string map' skips the "" case. */ - resultPtr = Tcl_NewUnicodeObj(wstring, 0); - Tcl_IncrRefCount(resultPtr); - for (; wstring < wend; wstring++) { - Tcl_AppendUnicodeToObj(resultPtr, wsubspec, wsublen); - Tcl_AppendUnicodeToObj(resultPtr, wstring, 1); - numMatches++; + if (wstring < wend) { + resultPtr = Tcl_NewUnicodeObj(wstring, 0); + Tcl_IncrRefCount(resultPtr); + for (; wstring < wend; wstring++) { + Tcl_AppendUnicodeToObj(resultPtr, wsubspec, wsublen); + Tcl_AppendUnicodeToObj(resultPtr, wstring, 1); + numMatches++; + } + wlen = 0; } - wlen = 0; } else { wsrclc = Tcl_UniCharToLower(*wsrc); for (p = wfirstChar = wstring; wstring < wend; wstring++) { @@ -776,7 +778,6 @@ Tcl_RegsubObjCmd(dummy, interp, objc, objv) * On zero matches, just ignore the offset, since it shouldn't * matter to us in this case, and the user may have skewed it. */ - /*Tcl_AppendUnicodeToObj(resultPtr, wstring, wlen);*/ resultPtr = objv[1]; Tcl_IncrRefCount(resultPtr); } else if (offset < wlen) { |