diff options
author | hobbs <hobbs> | 2007-11-14 00:56:43 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2007-11-14 00:56:43 (GMT) |
commit | 39ece233fe80c466282f52377c052d4ac161ffd7 (patch) | |
tree | fc47cfd6bb115b54f1b160a7c074e2048c3b2143 | |
parent | 0c659b04bff167444e48ca6ec644467a81468ea6 (diff) | |
download | tcl-39ece233fe80c466282f52377c052d4ac161ffd7.zip tcl-39ece233fe80c466282f52377c052d4ac161ffd7.tar.gz tcl-39ece233fe80c466282f52377c052d4ac161ffd7.tar.bz2 |
(TclCompileSwitchCmd): simplify TclReToGlob usage.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 15 |
2 files changed, 7 insertions, 9 deletions
@@ -2,6 +2,7 @@ * generic/tclCompCmds.c (TclCompileRegexpCmd): clean up comments, only free dstring on OK from TclReToGlob. + (TclCompileSwitchCmd): simplify TclReToGlob usage. 2007-11-14 Donal K. Fellows <dkf@users.sf.net> 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); } |