diff options
author | dgp <dgp@users.sourceforge.net> | 2012-06-11 12:21:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-06-11 12:21:30 (GMT) |
commit | 2c0667d7b04e34fa929ccc4758a19af166cf4206 (patch) | |
tree | 9bf9a81dd9aa8afa81b52418459a33d8220223e8 /generic/tclProc.c | |
parent | ac5377745066c2cc9fdc1d30ff2d449e2bb5b6d4 (diff) | |
download | tcl-2c0667d7b04e34fa929ccc4758a19af166cf4206.zip tcl-2c0667d7b04e34fa929ccc4758a19af166cf4206.tar.gz tcl-2c0667d7b04e34fa929ccc4758a19af166cf4206.tar.bz2 |
Revised so that we avoid hashing twice.bug_3532959
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r-- | generic/tclProc.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c index 7a93dbf..2c6d300 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -2450,6 +2450,7 @@ SetLambdaFromAny( char *name; Tcl_Obj *argsPtr, *bodyPtr, *nsObjPtr, **objv, *errPtr; int isNew, objc, result; + CmdFrame *cfPtr = NULL; Proc *procPtr; if (interp == NULL) { @@ -2514,8 +2515,6 @@ SetLambdaFromAny( * common elements into a single function. */ - Tcl_SetHashValue(Tcl_CreateHashEntry(iPtr->linePBodyPtr, (char *) procPtr, - &isNew), NULL); if (iPtr->cmdFramePtr) { CmdFrame *contextPtr; @@ -2549,13 +2548,13 @@ SetLambdaFromAny( if (contextPtr->line && (contextPtr->nline >= 2) && (contextPtr->line[1] >= 0)) { int buf[2]; - CmdFrame *cfPtr = (CmdFrame *) ckalloc(sizeof(CmdFrame)); /* * Move from approximation (line of list cmd word) to actual * location (line of 2nd list element). */ + cfPtr = (CmdFrame *) ckalloc(sizeof(CmdFrame)); TclListLines(objPtr, contextPtr->line[1], 2, buf, NULL); cfPtr->level = -1; @@ -2571,9 +2570,6 @@ SetLambdaFromAny( cfPtr->cmd.str.cmd = NULL; cfPtr->cmd.str.len = 0; - - Tcl_SetHashValue(Tcl_CreateHashEntry(iPtr->linePBodyPtr, - (char *) procPtr, &isNew), cfPtr); } /* @@ -2585,6 +2581,8 @@ SetLambdaFromAny( } TclStackFree(interp, contextPtr); } + Tcl_SetHashValue(Tcl_CreateHashEntry(iPtr->linePBodyPtr, (char *) procPtr, + &isNew), cfPtr); /* * Set the namespace for this lambda: given by objv[2] understood as a |