diff options
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r-- | generic/tclProc.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c index e0d6ec7..6ffbd90 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -69,9 +69,9 @@ const Tcl_ObjType tclProcBodyType = { }; /* - * The [upvar]/[uplevel] level reference type. Uses the ptrAndLongRep field, + * The [upvar]/[uplevel] level reference type. Uses the twoPtrValue field, * encoding the type of level reference in ptr and the actual parsed out - * offset in value. + * offset in ptr2. * * Uses the default behaviour throughout, and never disposes of the string * rep; it's just a cache type. @@ -823,10 +823,10 @@ TclObjGetFrame( name = TclGetString(objPtr); if (objPtr->typePtr == &levelReferenceType) { - if (objPtr->internalRep.ptrAndLongRep.ptr != NULL) { - level = curLevel - objPtr->internalRep.ptrAndLongRep.value; + if (objPtr->internalRep.twoPtrValue.ptr1) { + level = curLevel - PTR2INT(objPtr->internalRep.twoPtrValue.ptr2); } else { - level = objPtr->internalRep.ptrAndLongRep.value; + level = PTR2INT(objPtr->internalRep.twoPtrValue.ptr2); } if (level < 0) { goto levelError; @@ -848,14 +848,12 @@ TclObjGetFrame( /* * Cache for future reference. - * - * TODO: Use the new ptrAndLongRep intrep */ TclFreeIntRep(objPtr); objPtr->typePtr = &levelReferenceType; - objPtr->internalRep.ptrAndLongRep.ptr = NULL; - objPtr->internalRep.ptrAndLongRep.value = level; + objPtr->internalRep.twoPtrValue.ptr1 = (void *) 0; + objPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(level); } else if (isdigit(UCHAR(*name))) { /* INTL: digit */ if (Tcl_GetInt(interp, name, &level) != TCL_OK) { return -1; @@ -863,14 +861,12 @@ TclObjGetFrame( /* * Cache for future reference. - * - * TODO: Use the new ptrAndLongRep intrep */ TclFreeIntRep(objPtr); objPtr->typePtr = &levelReferenceType; - objPtr->internalRep.ptrAndLongRep.ptr = (void *) 1; /* non-NULL */ - objPtr->internalRep.ptrAndLongRep.value = level; + objPtr->internalRep.twoPtrValue.ptr1 = (void *) 1; + objPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(level); level = curLevel - level; } else { /* @@ -2450,8 +2446,7 @@ FreeLambdaInternalRep( Proc *procPtr = objPtr->internalRep.twoPtrValue.ptr1; Tcl_Obj *nsObjPtr = objPtr->internalRep.twoPtrValue.ptr2; - procPtr->refCount--; - if (procPtr->refCount == 0) { + if (procPtr->refCount-- == 1) { TclProcCleanupProc(procPtr); } TclDecrRefCount(nsObjPtr); |