diff options
author | griffin <briang42@easystreet.net> | 2023-07-07 21:06:45 (GMT) |
---|---|---|
committer | griffin <briang42@easystreet.net> | 2023-07-07 21:06:45 (GMT) |
commit | 14cb83639fafb1fe344e5b5b7cb10d27c590dade (patch) | |
tree | ab98b61617c2c1636f7d2b473b2cf2bf500dc77d /generic/tclCmdIL.c | |
parent | 68d6146f53bda325bbbee13134bbf96afb8e9d4a (diff) | |
download | tcl-14cb83639fafb1fe344e5b5b7cb10d27c590dade.zip tcl-14cb83639fafb1fe344e5b5b7cb10d27c590dade.tar.gz tcl-14cb83639fafb1fe344e5b5b7cb10d27c590dade.tar.bz2 |
Cleanup abstract list ObjType function definitions.
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r-- | generic/tclCmdIL.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index cc645f3..d52d6d5 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2215,12 +2215,11 @@ Tcl_JoinObjCmd( * pointer to its array of element pointers. */ - Tcl_ObjTypeGetElements *getElementsProc = TclObjTypeHasProc(objv[1], getElementsProc); - if (getElementsProc) { - listLen = TclObjTypeHasProc(objv[1], lengthProc)(objv[1]); + if (TclObjTypeHasProc(objv[1], getElementsProc)) { + listLen = TclObjTypeLength(objv[1]); isAbstractList = (listLen ? 1 : 0); if (listLen > 1 && - getElementsProc(interp, objv[1], &listLen, &elemPtrs) + TclObjTypeGetElements(interp, objv[1], &listLen, &elemPtrs) != TCL_OK) { return TCL_ERROR; } @@ -2239,7 +2238,7 @@ Tcl_JoinObjCmd( Tcl_SetObjResult(interp, elemPtrs[0]); } else { Tcl_Obj *elemObj; - if (TclObjTypeHasProc(objv[1], indexProc)(interp, objv[1], 0, &elemObj) + if (TclObjTypeIndex(interp, objv[1], 0, &elemObj) != TCL_OK) { return TCL_ERROR; } @@ -2769,10 +2768,9 @@ Tcl_LrangeObjCmd( return result; } - Tcl_ObjTypeSliceProc *sliceProc = TclObjTypeHasProc(objv[1], sliceProc); - if (sliceProc) { + if (TclObjTypeHasProc(objv[1], sliceProc)) { Tcl_Obj *resultObj; - int status = sliceProc(interp, objv[1], first, last, &resultObj); + int status = TclObjTypeSlice(interp, objv[1], first, last, &resultObj); if (status == TCL_OK) { Tcl_SetObjResult(interp, resultObj); } else { @@ -3194,11 +3192,10 @@ Tcl_LreverseObjCmd( * Handle AbstractList special case - do not shimmer into a list, if it * supports a private Reverse function, just to reverse it. */ - Tcl_ObjTypeReverseProc *reverseProc = TclObjTypeHasProc(objv[1], reverseProc); - if (reverseProc) { + if (TclObjTypeHasProc(objv[1], reverseProc)) { Tcl_Obj *resultObj; - if (reverseProc(interp, objv[1], &resultObj) == TCL_OK) { + if (TclObjTypeReverse(interp, objv[1], &resultObj) == TCL_OK) { Tcl_SetObjResult(interp, resultObj); return TCL_OK; } @@ -4479,9 +4476,8 @@ Tcl_LsetObjCmd( if (objc == 4) { finalValuePtr = TclLsetList(interp, listPtr, objv[2], objv[3]); } else { - Tcl_ObjTypeSetElement *setElementProc = TclObjTypeHasProc(listPtr, setElementProc); - if (setElementProc) { - finalValuePtr = setElementProc(interp, listPtr, + if (TclObjTypeHasProc(listPtr, setElementProc)) { + finalValuePtr = TclObjTypeSetElement(interp, listPtr, objc-3, objv+2, objv[objc-1]); if (finalValuePtr) { Tcl_IncrRefCount(finalValuePtr); @@ -4788,10 +4784,9 @@ Tcl_LsortObjCmd( sortInfo.compareCmdPtr = newCommandPtr; } - Tcl_ObjTypeGetElements *getElementsProc = TclObjTypeHasProc(objv[1], getElementsProc); - if (getElementsProc) { + if (TclObjTypeHasProc(objv[1], getElementsProc)) { sortInfo.resultCode = - getElementsProc(interp, listObj, &length, &listObjPtrs); + TclObjTypeGetElements(interp, listObj, &length, &listObjPtrs); } else { sortInfo.resultCode = TclListObjGetElementsM(interp, listObj, &length, &listObjPtrs); |