diff options
-rwxr-xr-x | generic/tclArithSeries.c | 19 | ||||
-rw-r--r-- | generic/tclInt.h | 10 | ||||
-rw-r--r-- | generic/tclTestABSList.c | 20 |
3 files changed, 20 insertions, 29 deletions
diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c index 3f980c4..c4c65a3 100755 --- a/generic/tclArithSeries.c +++ b/generic/tclArithSeries.c @@ -288,17 +288,18 @@ DupArithSeriesInternalRep( static void FreeArithSeriesInternalRep(Tcl_Obj *arithSeriesObjPtr) /* Free any allocated memory */ { - ArithSeries *arithSeriesObj = (ArithSeries*)Tcl_ObjGetConcreteRep(arithSeriesObjPtr); - if (arithSeriesObj) { - if (arithSeriesObj->elements) { - Tcl_WideInt i, len = arithSeriesObj->len; + ArithSeries *arithSeriesRepPtr = (ArithSeries*)arithSeriesObjPtr->internalRep.twoPtrValue.ptr1; + + if (arithSeriesRepPtr) { + if (arithSeriesRepPtr->elements) { + Tcl_WideInt i, len = arithSeriesRepPtr->len; for (i=0; i<len; i++) { - Tcl_DecrRefCount(arithSeriesObj->elements[i]); + Tcl_DecrRefCount(arithSeriesRepPtr->elements[i]); } - Tcl_Free((char*)arithSeriesObj->elements); - arithSeriesObj->elements = NULL; + Tcl_Free((char*)arithSeriesRepPtr->elements); + arithSeriesRepPtr->elements = NULL; } - Tcl_Free((char*)arithSeriesObj); + Tcl_Free((char*)arithSeriesRepPtr); } } @@ -1044,7 +1045,7 @@ TclArithSeriesObjReverse( static void UpdateStringOfArithSeries(Tcl_Obj *arithSeriesObjPtr) { - ArithSeries *arithSeriesRepPtr = (ArithSeries*)Tcl_ObjGetConcreteRep(arithSeriesObjPtr); + ArithSeries *arithSeriesRepPtr = (ArithSeries*)arithSeriesObjPtr->internalRep.twoPtrValue.ptr1; char *p; Tcl_Obj *eleObj; Tcl_Size i, bytlen = 0; diff --git a/generic/tclInt.h b/generic/tclInt.h index 7afdd24..a4dca79 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1120,16 +1120,6 @@ MODULE_SCOPE Tcl_Size TclLengthOne(Tcl_Obj *); /* - * Return the internal rep for the Obj. - * Note: Caller is responsible for confirming and casting returned value. - */ -static inline void* Tcl_ObjGetConcreteRep( - Tcl_Obj *objPtr) /* Object of type AbstractList */ -{ - return objPtr->internalRep.twoPtrValue.ptr1; -} - -/* * The structure below defines an entry in the assocData hash table which is * associated with an interpreter. The entry contains a pointer to a function * to call when the interpreter is deleted, and a pointer to a user-defined diff --git a/generic/tclTestABSList.c b/generic/tclTestABSList.c index 1593a85..13fc799 100644 --- a/generic/tclTestABSList.c +++ b/generic/tclTestABSList.c @@ -274,7 +274,7 @@ my_LStringObjIndex( Tcl_Size index, Tcl_Obj **charObjPtr) { - LString *lstringRepPtr = (LString*)Tcl_ObjGetConcreteRep(lstringObj); + LString *lstringRepPtr = (LString*)lstringObj->internalRep.twoPtrValue.ptr1; (void)interp; @@ -311,7 +311,7 @@ my_LStringObjIndex( static Tcl_Size my_LStringObjLength(Tcl_Obj *lstringObjPtr) { - LString *lstringRepPtr = (LString *)Tcl_ObjGetConcreteRep(lstringObjPtr); + LString *lstringRepPtr = (LString *)lstringObjPtr->internalRep.twoPtrValue.ptr1; return lstringRepPtr->strlen; } @@ -336,7 +336,7 @@ my_LStringObjLength(Tcl_Obj *lstringObjPtr) static void DupLStringRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) { - LString *srcLString = (LString*)Tcl_ObjGetConcreteRep(srcPtr); + LString *srcLString = (LString*)srcPtr->internalRep.twoPtrValue.ptr1; LString *copyLString = (LString*)Tcl_Alloc(sizeof(LString)); memcpy(copyLString, srcLString, sizeof(LString)); @@ -379,7 +379,7 @@ my_LStringObjSetElem( Tcl_Obj *const indicies[], Tcl_Obj *valueObj) { - LString *lstringRepPtr = (LString*)Tcl_ObjGetConcreteRep(lstringObj); + LString *lstringRepPtr = (LString*)lstringObj->internalRep.twoPtrValue.ptr1; Tcl_Size index; const char *newvalue; int status; @@ -397,7 +397,7 @@ my_LStringObjSetElem( } returnObj = Tcl_IsShared(lstringObj) ? Tcl_DuplicateObj(lstringObj) : lstringObj; - lstringRepPtr = (LString*)Tcl_ObjGetConcreteRep(returnObj); + lstringRepPtr = (LString*)returnObj->internalRep.twoPtrValue.ptr1; if (index >= lstringRepPtr->strlen) { index = lstringRepPtr->strlen; @@ -437,7 +437,7 @@ static int my_LStringObjRange( Tcl_Obj **newObjPtr) { Tcl_Obj *rangeObj; - LString *lstringRepPtr = (LString*)Tcl_ObjGetConcreteRep(lstringObj); + LString *lstringRepPtr = (LString*)lstringObj->internalRep.twoPtrValue.ptr1; LString *rangeRep; Tcl_WideInt len = toIdx - fromIdx + 1; @@ -494,7 +494,7 @@ static int my_LStringObjRange( static int my_LStringObjReverse(Tcl_Interp *interp, Tcl_Obj *srcObj, Tcl_Obj **newObjPtr) { - LString *srcRep = (LString*)Tcl_ObjGetConcreteRep(srcObj); + LString *srcRep = (LString*)srcObj->internalRep.twoPtrValue.ptr1; Tcl_Obj *revObj; LString *revRep = (LString*)Tcl_Alloc(sizeof(LString)); Tcl_ObjInternalRep itr; @@ -553,7 +553,7 @@ my_LStringReplace( Tcl_Size numToInsert, Tcl_Obj *const insertObjs[]) { - LString *lstringRep = (LString*)Tcl_ObjGetConcreteRep(listObj); + LString *lstringRep = (LString*)listObj->internalRep.twoPtrValue.ptr1; Tcl_Size newLen; Tcl_Size x, ix, kx; char *newStr; @@ -745,7 +745,7 @@ my_NewLStringObj( static void freeRep(Tcl_Obj* lstringObj) { - LString *lstringRepPtr = (LString*)Tcl_ObjGetConcreteRep(lstringObj); + LString *lstringRepPtr = (LString*)lstringObj->internalRep.twoPtrValue.ptr1; if (lstringRepPtr->string) { Tcl_Free(lstringRepPtr->string); } @@ -782,7 +782,7 @@ static int my_LStringGetElements(Tcl_Interp *interp, Tcl_Size *objcptr, Tcl_Obj ***objvptr) { - LString *lstringRepPtr = (LString*)Tcl_ObjGetConcreteRep(lstringObj); + LString *lstringRepPtr = (LString*)lstringObj->internalRep.twoPtrValue.ptr1; Tcl_Obj **objPtr; char *cptr = lstringRepPtr->string; (void)interp; |