summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2007-11-14 00:56:43 (GMT)
committerhobbs <hobbs@noemail.net>2007-11-14 00:56:43 (GMT)
commit7acdf27b148e60ffc974278374732b0281620904 (patch)
treefc47cfd6bb115b54f1b160a7c074e2048c3b2143 /generic/tclCompCmds.c
parent95c8fa13c4299b9020b3862a3414558104c71dd7 (diff)
downloadtcl-7acdf27b148e60ffc974278374732b0281620904.zip
tcl-7acdf27b148e60ffc974278374732b0281620904.tar.gz
tcl-7acdf27b148e60ffc974278374732b0281620904.tar.bz2
(TclCompileSwitchCmd): simplify TclReToGlob usage.
FossilOrigin-Name: e384914b4b0b46ce0aa64adbca33d76c108d008e
Diffstat (limited to 'generic/tclCompCmds.c')
-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);
}