From 3e05a7babe9e956c84144a05bdf7a1acdd38611f Mon Sep 17 00:00:00 2001 From: pooryorick Date: Fri, 5 May 2023 09:40:38 +0000 Subject: Remove TclArithSeriesObjCopy() and use Tcl_DuplicateObj() instead. --- generic/tclArithSeries.c | 46 ---------------------------------------------- generic/tclArithSeries.h | 2 -- generic/tclCmdAH.c | 2 +- generic/tclListObj.c | 2 +- 4 files changed, 2 insertions(+), 50 deletions(-) diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c index 4571b4a..1019677 100755 --- a/generic/tclArithSeries.c +++ b/generic/tclArithSeries.c @@ -760,52 +760,6 @@ SetArithSeriesFromAny( /* *---------------------------------------------------------------------- * - * TclArithSeriesObjCopy -- - * - * Makes a "pure arithSeries" copy of an ArithSeries value. This provides for the C - * level a counterpart of the [lrange $list 0 end] command, while using - * internals details to be as efficient as possible. - * - * Results: - * - * Normally returns a pointer to a new Tcl_Obj, that contains the same - * arithSeries value as *arithSeriesObj does. The returned Tcl_Obj has a - * refCount of zero. If *arithSeriesObj does not hold an arithSeries, - * NULL is returned, and if interp is non-NULL, an error message is - * recorded there. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -Tcl_Obj * -TclArithSeriesObjCopy( - Tcl_Interp *interp, /* Used to report errors if not NULL. */ - Tcl_Obj *arithSeriesObj) /* List object for which an element array is - * to be returned. */ -{ - Tcl_Obj *copyPtr; - ArithSeries *arithSeriesRepPtr; - - arithSeriesRepPtr = ArithSeriesGetInternalRep(arithSeriesObj); - if (NULL == arithSeriesRepPtr) { - if (SetArithSeriesFromAny(interp, arithSeriesObj) != TCL_OK) { - /* We know this is going to panic, but it's the message we want */ - return NULL; - } - } - - TclNewObj(copyPtr); - TclInvalidateStringRep(copyPtr); - DupArithSeriesInternalRep(arithSeriesObj, copyPtr); - return copyPtr; -} - -/* - *---------------------------------------------------------------------- - * * TclArithSeriesObjRange -- * * Makes a slice of an ArithSeries value. diff --git a/generic/tclArithSeries.h b/generic/tclArithSeries.h index 61538c4..8002239 100644 --- a/generic/tclArithSeries.h +++ b/generic/tclArithSeries.h @@ -34,8 +34,6 @@ typedef struct { } ArithSeriesDbl; -MODULE_SCOPE Tcl_Obj * TclArithSeriesObjCopy(Tcl_Interp *interp, - Tcl_Obj *arithSeriesPtr); MODULE_SCOPE Tcl_Obj *TclArithSeriesObjIndex(Tcl_Interp *, Tcl_Obj *, Tcl_WideInt index); MODULE_SCOPE Tcl_Obj * TclArithSeriesObjRange(Tcl_Interp *interp, diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index e2186ed..4045e2f 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -2811,7 +2811,7 @@ EachloopCmd( /* Values */ if (TclHasInternalRep(objv[2+i*2],&tclArithSeriesType.objType)) { /* Special case for Arith Series */ - statePtr->aCopyList[i] = TclArithSeriesObjCopy(interp, objv[2+i*2]); + statePtr->aCopyList[i] = Tcl_DuplicateObj(objv[2+i*2]); if (statePtr->aCopyList[i] == NULL) { result = TCL_ERROR; goto done; diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 726b8dd..257925e 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -1386,7 +1386,7 @@ TclListObjCopy( if (!TclHasInternalRep(listObj, &tclListType.objType)) { if (TclHasInternalRep(listObj,&tclArithSeriesType.objType)) { - return TclArithSeriesObjCopy(interp, listObj); + return Tcl_DuplicateObj(listObj); } if (SetListFromAny(interp, listObj) != TCL_OK) { return NULL; -- cgit v0.12