From c3f8318a3f328bd39244bc8f88ed606848ec5b85 Mon Sep 17 00:00:00 2001 From: griffin Date: Wed, 24 May 2023 20:13:20 +0000 Subject: Cleanup abstract list definitions. --- generic/tcl.h | 24 ++++++++++++------------ generic/tclInt.h | 18 +++++------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 58add97..ac4b252 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -679,19 +679,19 @@ typedef struct Tcl_ObjType { } Tcl_ObjType; #define TCL_OBJTYPE_V0 0, /* Pre-Tcl 9 */ \ - NULL, \ - NULL, \ - NULL, \ - NULL, \ - NULL, \ - NULL, \ - NULL, \ - NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ NULL -#define TCL_OBJTYPE_CURRENT sizeof(Tcl_ObjType) -#define TCL_OBJTYPE_V1(a,b,c,d,e,f,g,h,i) \ - TCL_OBJTYPE_CURRENT, \ - a,b,c,d,e,f,g,h,i /* Tcl 9 - AbstractLists */ +#define TCL_OBJTYPE_CURRENT 1 +#define TCL_OBJTYPE_V1(a,b,c,d,e,f,g,h,i) \ + TCL_OBJTYPE_CURRENT, \ + a,b,c,d,e,f,g,h,i /* Tcl 9 - AbstractLists */ /* * The following structure stores an internal representation (internalrep) for diff --git a/generic/tclInt.h b/generic/tclInt.h index 8f8cd13..c92e24b 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1092,18 +1092,10 @@ typedef struct ActiveInterpTrace { #define TCL_TRACE_ENTER_EXEC 1 #define TCL_TRACE_LEAVE_EXEC 2 -typedef struct { /* For internal core use only */ - Tcl_ObjType objType; - struct { - Tcl_Size (*lengthProc)(Tcl_Obj *obj); - } abstractList; -} TclObjTypeWithAbstractList; -#define TCL_OBJTYPE_V0_1(lengthProc) (sizeof(TclObjTypeWithAbstractList)) \ - }, {lengthProc /* For internal core use only */ -#define ABSTRACTLIST_PROC(objPtr, proc) (((objPtr)->typePtr \ - && ((offsetof(Tcl_ObjType, proc) < offsetof(Tcl_ObjType, version)) \ - || ((objPtr)->typePtr->version > offsetof(Tcl_ObjType, proc)))) ? \ - ((objPtr)->typePtr)->proc : NULL) +#define ABSTRACTLIST_PROC(objPtr, proc) \ + (((objPtr)->typePtr \ + && (objPtr)->typePtr->version == TCL_OBJTYPE_CURRENT) ? \ + ((objPtr)->typePtr)->proc : NULL) MODULE_SCOPE Tcl_Size TclLengthOne(Tcl_Obj *); @@ -2947,7 +2939,7 @@ static inline Tcl_Size TclUpsizeRetry(Tcl_Size needed, Tcl_Size lastAttempt) { MODULE_SCOPE void *TclAllocElemsEx(Tcl_Size elemCount, Tcl_Size elemSize, Tcl_Size leadSize, Tcl_Size *capacityPtr); MODULE_SCOPE void *TclReallocElemsEx(void *oldPtr, Tcl_Size elemCount, - Tcl_Size elemSize, Tcl_Size leadSize, + Tcl_Size elemSize, Tcl_Size leadSize, Tcl_Size *capacityPtr); MODULE_SCOPE void *TclAttemptReallocElemsEx(void *oldPtr, Tcl_Size elemCount, Tcl_Size elemSize, -- cgit v0.12