diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-04-10 14:47:06 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-04-10 14:47:06 (GMT) |
commit | 0379fe02395721d2ea1419c61ca69ec818561082 (patch) | |
tree | e12acd4bb445070087067812722f564f29218f8d /generic/tclCompile.c | |
parent | f7f181d5456b19b4726f71223362bf82d761d8ff (diff) | |
download | tcl-0379fe02395721d2ea1419c61ca69ec818561082.zip tcl-0379fe02395721d2ea1419c61ca69ec818561082.tar.gz tcl-0379fe02395721d2ea1419c61ca69ec818561082.tar.bz2 |
Handle creation of Tcl_Objs from constant strings better (easier to use, more
efficient). After [Patch 1529526] (afredd)
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r-- | generic/tclCompile.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 11cff19..5a3633d 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.114 2007/04/08 02:19:31 msofer Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.115 2007/04/10 14:47:10 dkf Exp $ */ #include "tclInt.h" @@ -1176,8 +1176,7 @@ TclCompileScript( * Compile bytecodes to report the parse error at runtime. */ - Tcl_Obj *returnCmd = Tcl_NewStringObj( - "return -code 1 -level 0 -errorinfo", -1); + Tcl_Obj *returnCmd; Tcl_Obj *errMsg = Tcl_GetObjResult(interp); Tcl_Obj *errInfo = Tcl_DuplicateObj(errMsg); char *cmdString; @@ -1185,6 +1184,8 @@ TclCompileScript( Tcl_Parse subParse; int errorLine = 1; + TclNewLiteralStringObj(returnCmd, + "return -code 1 -level 0 -errorinfo"); Tcl_IncrRefCount(returnCmd); Tcl_IncrRefCount(errInfo); Tcl_AppendToObj(errInfo, "\n while executing\n\"", -1); |