summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index ee19f8a..74181a4 100644
--- a/generic/tkText.c
+++ b/generic/tkText.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: tkText.c,v 1.3 1999/04/16 01:51:23 stanton Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.4 1999/04/17 02:31:20 rjohnson Exp $
*/
#include "default.h"
@@ -1624,8 +1624,10 @@ TextSearchCmd(textPtr, interp, argc, argv)
Tcl_UtfToLower(pattern);
}
+ Tcl_DStringInit(&line);
if (TkTextGetIndex(interp, textPtr, argv[i+1], &index) != TCL_OK) {
- return TCL_ERROR;
+ code = TCL_ERROR;
+ goto done;
}
numLines = TkBTreeNumLines(textPtr->tree);
startingLine = TkBTreeLineIndex(index.linePtr);
@@ -1642,7 +1644,8 @@ TextSearchCmd(textPtr, interp, argc, argv)
}
if (argsLeft == 1) {
if (TkTextGetIndex(interp, textPtr, argv[i+2], &stopIndex) != TCL_OK) {
- return TCL_ERROR;
+ code = TCL_ERROR;
+ goto done;
}
stopLine = TkBTreeLineIndex(stopIndex.linePtr);
if (!backwards && (stopLine == numLines)) {
@@ -1666,12 +1669,12 @@ TextSearchCmd(textPtr, interp, argc, argv)
} else {
regexp = Tcl_RegExpCompile(interp, pattern);
if (regexp == NULL) {
- return TCL_ERROR;
+ code = TCL_ERROR;
+ goto done;
}
}
lineNum = startingLine;
code = TCL_OK;
- Tcl_DStringInit(&line);
for (passes = 0; passes < 2; ) {
if (lineNum >= numLines) {
/*