diff options
author | dgp <dgp@noemail.net> | 2003-05-23 21:29:10 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2003-05-23 21:29:10 (GMT) |
commit | f65310f7a70c4bea0f4ef02e5eac1835bb35ace4 (patch) | |
tree | b001540521554ba042f23783b3674dc5ac200dee /generic/tclObj.c | |
parent | 2c1a2ff8ec45bebbe784900f40787fc4bd56b90e (diff) | |
download | tcl-f65310f7a70c4bea0f4ef02e5eac1835bb35ace4.zip tcl-f65310f7a70c4bea0f4ef02e5eac1835bb35ace4.tar.gz tcl-f65310f7a70c4bea0f4ef02e5eac1835bb35ace4.tar.bz2 |
* generic/tclObj.c (tclCmdNameType): Converted internal rep
management of the cmdName Tcl_ObjType the opposite way, to always
use the twoPtrValue instead of always using the otherValuePtr.
Previous fix on 2003-05-12 broke several extensions that wanted
to poke around with the twoPtrValue.ptr2 value of a cmdName
Tcl_Obj, like TclBlend and e4graph. [Bug 726018]
FossilOrigin-Name: 347c8b73241af774798af7a2ad2e91babe35a939
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r-- | generic/tclObj.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index bf496ec..a98fe1c 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.42.2.3 2003/05/12 19:29:50 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.42.2.4 2003/05/23 21:29:11 dgp Exp $ */ #include "tclInt.h" @@ -156,6 +156,13 @@ Tcl_HashKeyType tclObjHashKeyType = { * type cache the Command pointer that results from looking up command names * in the command hashtable. Such objects appear as the zeroth ("command * name") argument in a Tcl command. + * + * NOTE: the ResolvedCmdName that gets cached is stored in the + * twoPtrValue.ptr1 field, and the twoPtrValue.ptr2 field is unused. + * You might think you could use the simpler otherValuePtr field to + * store the single ResolvedCmdName pointer, but DO NOT DO THIS. It + * seems that some extensions use the second internal pointer field + * of the twoPtrValue field for their own purposes. */ static Tcl_ObjType tclCmdNameType = { @@ -2883,7 +2890,7 @@ Tcl_GetCommandFromObj(interp, objPtr) return (Tcl_Command) NULL; } } - resPtr = (ResolvedCmdName *) objPtr->internalRep.otherValuePtr; + resPtr = (ResolvedCmdName *) objPtr->internalRep.twoPtrValue.ptr1; /* * Get the current namespace. @@ -2922,7 +2929,7 @@ Tcl_GetCommandFromObj(interp, objPtr) iPtr->varFramePtr = savedFramePtr; return (Tcl_Command) NULL; } - resPtr = (ResolvedCmdName *) objPtr->internalRep.otherValuePtr; + resPtr = (ResolvedCmdName *) objPtr->internalRep.twoPtrValue.ptr1; if (resPtr != NULL) { cmdPtr = resPtr->cmdPtr; } @@ -2991,7 +2998,8 @@ TclSetCmdNameObj(interp, objPtr, cmdPtr) if ((oldTypePtr != NULL) && (oldTypePtr->freeIntRepProc != NULL)) { oldTypePtr->freeIntRepProc(objPtr); } - objPtr->internalRep.otherValuePtr = (VOID *) resPtr; + objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) resPtr; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclCmdNameType; } @@ -3022,7 +3030,7 @@ FreeCmdNameInternalRep(objPtr) * representation to free. */ { register ResolvedCmdName *resPtr = - (ResolvedCmdName *) objPtr->internalRep.otherValuePtr; + (ResolvedCmdName *) objPtr->internalRep.twoPtrValue.ptr1; if (resPtr != NULL) { /* @@ -3071,9 +3079,10 @@ DupCmdNameInternalRep(srcPtr, copyPtr) register Tcl_Obj *copyPtr; /* Object with internal rep to set. */ { register ResolvedCmdName *resPtr = - (ResolvedCmdName *) srcPtr->internalRep.otherValuePtr; + (ResolvedCmdName *) srcPtr->internalRep.twoPtrValue.ptr1; - copyPtr->internalRep.otherValuePtr = (VOID *) resPtr; + copyPtr->internalRep.twoPtrValue.ptr1 = (VOID *) resPtr; + copyPtr->internalRep.twoPtrValue.ptr2 = NULL; if (resPtr != NULL) { resPtr->refCount++; } @@ -3168,7 +3177,8 @@ SetCmdNameFromAny(interp, objPtr) objPtr->typePtr->freeIntRepProc(objPtr); } - objPtr->internalRep.otherValuePtr = (VOID *) resPtr; + objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) resPtr; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclCmdNameType; return TCL_OK; } |