diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-07-27 13:10:40 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-07-27 13:10:40 (GMT) |
| commit | 503165d9c2e5c4c5f35681047d987d17debcf2a5 (patch) | |
| tree | 4bc3f5ea871c8462a8dcbd9287d3955dbb59f5cc | |
| parent | af64c95042a9706c6d45118c8f341aafa5c26686 (diff) | |
| parent | e4971bdffcb5ad9da61fec42904e83511c80108d (diff) | |
| download | tcl-503165d9c2e5c4c5f35681047d987d17debcf2a5.zip tcl-503165d9c2e5c4c5f35681047d987d17debcf2a5.tar.gz tcl-503165d9c2e5c4c5f35681047d987d17debcf2a5.tar.bz2 | |
Proposed fix for [e58d7e19e9]: Upwards compatibility of TclObjTypeHasProc()
| -rw-r--r-- | generic/tcl.h | 4 | ||||
| -rw-r--r-- | generic/tclInt.h | 14 |
2 files changed, 6 insertions, 12 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index cae8fb6..306e1e1 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -677,9 +677,9 @@ typedef struct Tcl_ObjType { #if TCL_MAJOR_VERSION > 8 # define TCL_OBJTYPE_V0 0, \ 0,0,0,0,0,0,0 /* Pre-Tcl 9 */ -# define TCL_OBJTYPE_V1(a) 1, \ +# define TCL_OBJTYPE_V1(a) offsetof(Tcl_ObjType, indexProc), \ a,0,0,0,0,0,0 /* Tcl 9 Version 1 */ -# define TCL_OBJTYPE_V2(a,b,c,d,e,f,g) 2, \ +# define TCL_OBJTYPE_V2(a,b,c,d,e,f,g) sizeof(Tcl_ObjType), \ a,b,c,d,e,f,g /* Tcl 9 - AbstractLists */ #else # define TCL_OBJTYPE_V0 /* just empty */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 9c7ad17..599fb2d 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1084,16 +1084,10 @@ typedef struct ActiveInterpTrace { #define TCL_TRACE_LEAVE_EXEC 2 #if TCL_MAJOR_VERSION > 8 -/* - * Versions 0, 1, and 2 are currently supported concurrently for now - */ -#define TclObjTypeHasProc(objPtr, proc) \ - (((objPtr)->typePtr \ - && ( (objPtr)->typePtr->version == 1 \ - || (objPtr)->typePtr->version == 2)) \ - ? ((objPtr)->typePtr)->proc \ - : NULL) - +#define TclObjTypeHasProc(objPtr, proc) (((objPtr)->typePtr \ + && ((offsetof(Tcl_ObjType, proc) < offsetof(Tcl_ObjType, version)) \ + || (offsetof(Tcl_ObjType, proc) < (objPtr)->typePtr->version))) ? \ + ((objPtr)->typePtr)->proc : NULL) MODULE_SCOPE Tcl_Size TclLengthOne(Tcl_Obj *); |
