summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-04-10 14:47:06 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-04-10 14:47:06 (GMT)
commit0379fe02395721d2ea1419c61ca69ec818561082 (patch)
treee12acd4bb445070087067812722f564f29218f8d /generic/tclBasic.c
parentf7f181d5456b19b4726f71223362bf82d761d8ff (diff)
downloadtcl-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/tclBasic.c')
-rw-r--r--generic/tclBasic.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 66ab08d..3d58522 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.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: tclBasic.c,v 1.242 2007/04/04 13:29:57 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.243 2007/04/10 14:47:08 dkf Exp $
*/
#include "tclInt.h"
@@ -395,10 +395,10 @@ Tcl_CreateInterp(void)
iPtr->returnOpts = NULL;
iPtr->errorInfo = NULL;
- iPtr->eiVar = Tcl_NewStringObj("errorInfo", -1);
+ TclNewLiteralStringObj(iPtr->eiVar, "errorInfo");
Tcl_IncrRefCount(iPtr->eiVar);
iPtr->errorCode = NULL;
- iPtr->ecVar = Tcl_NewStringObj("errorCode", -1);
+ TclNewLiteralStringObj(iPtr->ecVar, "errorCode");
Tcl_IncrRefCount(iPtr->ecVar);
iPtr->returnLevel = 1;
iPtr->returnCode = TCL_OK;
@@ -3210,7 +3210,7 @@ Tcl_GetMathFuncInfo(
* Get the command that implements the math function.
*/
- cmdNameObj = Tcl_NewStringObj("tcl::mathfunc::", -1);
+ TclNewLiteralStringObj(cmdNameObj, "tcl::mathfunc::");
Tcl_AppendToObj(cmdNameObj, name, -1);
Tcl_IncrRefCount(cmdNameObj);
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, cmdNameObj);
@@ -3223,7 +3223,7 @@ Tcl_GetMathFuncInfo(
if (cmdPtr == NULL) {
Tcl_Obj *message;
- message = Tcl_NewStringObj("unknown math function \"", -1);
+ TclNewLiteralStringObj(message, "unknown math function \"");
Tcl_AppendToObj(message, name, -1);
Tcl_AppendToObj(message, "\"", 1);
Tcl_SetObjResult(interp, message);
@@ -3497,7 +3497,7 @@ TclEvalObjvInternal(
*/
if (currNsPtr->unknownHandlerPtr == NULL) {
- currNsPtr->unknownHandlerPtr = Tcl_NewStringObj("::unknown", -1);
+ TclNewLiteralStringObj(currNsPtr->unknownHandlerPtr, "::unknown");
Tcl_IncrRefCount(currNsPtr->unknownHandlerPtr);
}
@@ -3990,6 +3990,7 @@ TclEvalEx(
*/
Tcl_Obj *norm = Tcl_FSGetNormalizedPath(interp, iPtr->scriptFile);
+
if (!norm) {
/*
* Error message in the interp result.
@@ -3999,7 +4000,7 @@ TclEvalEx(
eeFrame.data.eval.path = norm;
Tcl_IncrRefCount(eeFrame.data.eval.path);
} else {
- eeFrame.data.eval.path = Tcl_NewStringObj("", -1);
+ TclNewLiteralStringObj(eeFrame.data.eval.path, "");
}
} else {
/*