diff options
author | griffin <briang42@easystreet.net> | 2022-10-18 01:03:19 (GMT) |
---|---|---|
committer | griffin <briang42@easystreet.net> | 2022-10-18 01:03:19 (GMT) |
commit | fb722eca5699fe89d2738fd6fc79f57ce9959026 (patch) | |
tree | 6cca55396a9e2dc62589b67ac6e13a62d0f8503a /generic/tclListObj.c | |
parent | 699ec9db36aee1d3bbba1ed943f6c33ca06b084a (diff) | |
download | tcl-fb722eca5699fe89d2738fd6fc79f57ce9959026.zip tcl-fb722eca5699fe89d2738fd6fc79f57ce9959026.tar.gz tcl-fb722eca5699fe89d2738fd6fc79f57ce9959026.tar.bz2 |
Add SetElement function to abstract lists. Fix a few bugs.
Diffstat (limited to 'generic/tclListObj.c')
-rw-r--r-- | generic/tclListObj.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index a1c53e6..24082ec 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -1667,20 +1667,19 @@ Tcl_ListObjGetElements( { ListRep listRep; - if (TclListObjGetRep(interp, objPtr, &listRep) != TCL_OK) { - if (TclHasInternalRep(objPtr,&tclAbstractListType)) { - // ? TODO: ?need error message here? - return (Tcl_AbstractListObjGetElements(interp, objPtr, objcPtr, objvPtr)); - } else { - int length; - (void) Tcl_GetStringFromObj(objPtr, &length); - if (length == 0) { - *objcPtr = 0; - *objvPtr = NULL; - return TCL_OK; - } + if (TclHasInternalRep(objPtr,&tclAbstractListType) && + TclAbstractListHasProc(objPtr, TCL_ABSL_GETELEMENTS) && + Tcl_AbstractListObjGetElements(interp, objPtr, objcPtr, objvPtr) == TCL_OK) { + return TCL_OK; + } else if (TclListObjGetRep(interp, objPtr, &listRep) != TCL_OK) { + int length; + (void) Tcl_GetStringFromObj(objPtr, &length); + if (length == 0) { + *objcPtr = 0; + *objvPtr = NULL; + return TCL_OK; } - return TCL_ERROR; + return TCL_ERROR; } ListRepElements(&listRep, *objcPtr, *objvPtr); return TCL_OK; |