diff options
author | dgp <dgp@users.sourceforge.net> | 2003-05-23 21:29:51 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2003-05-23 21:29:51 (GMT) |
commit | 784ee84b19f6ce45ed62c49c17e6427429c47fe4 (patch) | |
tree | d1a36adf288e16ef5b44ac5308de137c287960bb /generic | |
parent | 38a7bbfd51aba29761a09b692c4289ae16c87d6f (diff) | |
download | tcl-784ee84b19f6ce45ed62c49c17e6427429c47fe4.zip tcl-784ee84b19f6ce45ed62c49c17e6427429c47fe4.tar.gz tcl-784ee84b19f6ce45ed62c49c17e6427429c47fe4.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]
Diffstat (limited to 'generic')
-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 cf536a3..97db9f4 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.46 2003/05/12 19:32:43 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.47 2003/05/23 21:29:51 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 = { @@ -2884,7 +2891,7 @@ Tcl_GetCommandFromObj(interp, objPtr) return (Tcl_Command) NULL; } } - resPtr = (ResolvedCmdName *) objPtr->internalRep.otherValuePtr; + resPtr = (ResolvedCmdName *) objPtr->internalRep.twoPtrValue.ptr1; /* * Get the current namespace. @@ -2923,7 +2930,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; } @@ -2992,7 +2999,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; } @@ -3023,7 +3031,7 @@ FreeCmdNameInternalRep(objPtr) * representation to free. */ { register ResolvedCmdName *resPtr = - (ResolvedCmdName *) objPtr->internalRep.otherValuePtr; + (ResolvedCmdName *) objPtr->internalRep.twoPtrValue.ptr1; if (resPtr != NULL) { /* @@ -3072,9 +3080,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++; } @@ -3169,7 +3178,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; } |