summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs>2007-11-14 00:56:43 (GMT)
committerhobbs <hobbs>2007-11-14 00:56:43 (GMT)
commit39ece233fe80c466282f52377c052d4ac161ffd7 (patch)
treefc47cfd6bb115b54f1b160a7c074e2048c3b2143 /generic
parent0c659b04bff167444e48ca6ec644467a81468ea6 (diff)
downloadtcl-39ece233fe80c466282f52377c052d4ac161ffd7.zip
tcl-39ece233fe80c466282f52377c052d4ac161ffd7.tar.gz
tcl-39ece233fe80c466282f52377c052d4ac161ffd7.tar.bz2
(TclCompileSwitchCmd): simplify TclReToGlob usage.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmds.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 60f209f..f16d579 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.125 2007/11/14 00:50:50 hobbs Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.126 2007/11/14 00:56:44 hobbs Exp $
*/
#include "tclInt.h"
@@ -4090,7 +4090,6 @@ TclCompileSwitchCmd(
if (bodyToken[i]->type == TCL_TOKEN_TEXT) {
Tcl_DString ds;
- simple = 1;
if (bodyToken[i]->size == 0) {
/*
* The semantics of regexps are that they always match
@@ -4106,17 +4105,15 @@ TclCompileSwitchCmd(
* the converted pattern.
*/
- Tcl_DStringInit(&ds);
if (TclReToGlob(NULL, bodyToken[i]->start,
- bodyToken[i]->size, &ds, &exact) != TCL_OK) {
- TclCompileTokens(interp, bodyToken[i], 1, envPtr);
- simple = 0;
- } else {
+ bodyToken[i]->size, &ds, &exact) == TCL_OK) {
+ simple = 1;
PushLiteral(envPtr, Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds));
+ Tcl_DStringFree(&ds);
}
- Tcl_DStringFree(&ds);
- } else {
+ }
+ if (!simple) {
TclCompileTokens(interp, bodyToken[i], 1, envPtr);
}