From e05de40e35185e3d3f0dfea4f61f03ce09fb7277 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 19 Jun 2013 19:33:21 +0000 Subject: More use of simplifying macros. Replace dynamic allocation with automatic storage on the call stack. --- generic/tclCompile.c | 13 ++++++------- 1 file 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; } -- cgit v0.12