diff options
author | dgp <dgp@users.sourceforge.net> | 2013-06-19 19:33:21 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-06-19 19:33:21 (GMT) |
commit | e05de40e35185e3d3f0dfea4f61f03ce09fb7277 (patch) | |
tree | a6ebe7341e37c134a9a3379f959d053ac28170de | |
parent | cf557ca4a54a4f8d0ca476e5326675a9ab56f7f9 (diff) | |
download | tcl-e05de40e35185e3d3f0dfea4f61f03ce09fb7277.zip tcl-e05de40e35185e3d3f0dfea4f61f03ce09fb7277.tar.gz tcl-e05de40e35185e3d3f0dfea4f61f03ce09fb7277.tar.bz2 |
More use of simplifying macros.
Replace dynamic allocation with automatic storage on the call stack.
-rw-r--r-- | generic/tclCompile.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c index be5bedf..92875a2 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1762,7 +1762,7 @@ TclCompileScript( /* TIP #280 */ ExtCmdLoc *eclPtr = envPtr->extCmdMapPtr; int *wlines, wlineat, cmdLine, *clNext; - Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse)); + Tcl_Parse parse, *parsePtr = &parse; if (envPtr->iPtr == NULL) { Tcl_Panic("TclCompileScript() called on uninitialized CompileEnv"); @@ -2190,11 +2190,10 @@ TclCompileScript( */ if (envPtr->codeNext == entryCodeNext) { - TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr); + PushStringLiteral(envPtr, ""); } envPtr->numSrcBytes = p - script; - TclStackFree(interp, parsePtr); } /* @@ -2258,7 +2257,7 @@ TclCompileVarSubst( localVar = TclFindCompiledLocal(name, nameBytes, localVarName, envPtr); } if (localVar < 0) { - TclEmitPush(TclRegisterNewLiteral(envPtr, name, nameBytes), envPtr); + PushLiteral(envPtr, name, nameBytes); } /* @@ -2466,7 +2465,7 @@ TclCompileTokens( */ if (envPtr->codeNext == entryCodeNext) { - TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr); + PushStringLiteral(envPtr, ""); } Tcl_DStringFree(&textBuffer); @@ -2583,7 +2582,7 @@ TclCompileExprWords( for (i = 0; i < numWords; i++) { TclCompileTokens(interp, wordPtr+1, wordPtr->numComponents, envPtr); if (i < (numWords - 1)) { - TclEmitPush(TclRegisterNewLiteral(envPtr, " ", 1), envPtr); + PushStringLiteral(envPtr, " "); } wordPtr += wordPtr->numComponents + 1; } @@ -2638,7 +2637,7 @@ TclCompileNoOp( TclEmitOpcode(INST_POP, envPtr); } } - TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr); + PushStringLiteral(envPtr, ""); return TCL_OK; } |