From 2447c7a16931e1b4b8f7afd76d2ed88b81d897a2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 4 Nov 2022 10:05:22 +0000 Subject: [PATCH] More usage of Tcl_Size, in stead of #if's --- generic/itcl.h | 19 +++++++------------ generic/itclInt.h | 14 +++++--------- generic/itclIntDecls.h | 4 ---- generic/itclMigrate2TclCore.h | 8 +------- 4 files changed, 13 insertions(+), 32 deletions(-) diff --git a/generic/itcl.h b/generic/itcl.h index 9636b990..ac2845a0 100644 --- a/generic/itcl.h +++ b/generic/itcl.h @@ -132,18 +132,17 @@ ITCL_EXTERN int Itcl_SafeInit(Tcl_Interp *interp); #define ITCL_PRIVATE 3 #define ITCL_DEFAULT_PROTECT 4 +#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) && !defined(Tcl_Size) +# define Tcl_Size int +#endif + /* * Generic stack. */ typedef struct Itcl_Stack { void **values; /* values on stack */ -#if TCL_MAJOR_VERSION > 8 - size_t len; /* number of values on stack */ - size_t max; /* maximum size of stack */ -#else - int len; - int max; -#endif + Tcl_Size len; /* number of values on stack */ + Tcl_Size max; /* maximum size of stack */ void *space[5]; /* initial space for stack data */ } Itcl_Stack; @@ -162,11 +161,7 @@ typedef struct Itcl_ListElem { typedef struct Itcl_List { int validate; /* validation stamp */ -#if TCL_MAJOR_VERSION > 8 - size_t num; /* number of elements */ -#else - int num; -#endif + Tcl_Size num; /* number of elements */ struct Itcl_ListElem *head; /* previous element in linked list */ struct Itcl_ListElem *tail; /* next element in linked list */ } Itcl_List; diff --git a/generic/itclInt.h b/generic/itclInt.h index 4bf34e07..1e583cff 100644 --- a/generic/itclInt.h +++ b/generic/itclInt.h @@ -76,14 +76,10 @@ # endif #endif -#if TCL_MAJOR_VERSION > 8 -# define ITCL_Z_MODIFIER TCL_Z_MODIFIER -#else +#if TCL_MAJOR_VERSION == 8 # define ITCL_Z_MODIFIER "" -#endif - -#if !defined(Tcl_Size) -# define Tcl_Size int +#else +# define ITCL_Z_MODIFIER TCL_Z_MODIFIER #endif /* @@ -612,7 +608,7 @@ typedef struct ItclMethodVariable { typedef struct ItclClassCmdInfo { int type; int protection; -#if TCL_MAJOR_VERSION < 9 +#if TCL_MAJOR_VERSION == 8 int cmdNum; /* not actually used */ #endif Tcl_Namespace *nsPtr; @@ -640,7 +636,7 @@ typedef struct ItclVarLookup { */ typedef struct ItclCmdLookup { ItclMemberFunc* imPtr; /* function definition */ -#if TCL_MAJOR_VERSION < 9 +#if TCL_MAJOR_VERSION == 8 int cmdNum; /* not actually used */ #endif ItclClassCmdInfo *classCmdInfoPtr; diff --git a/generic/itclIntDecls.h b/generic/itclIntDecls.h index 460f9678..5b137879 100644 --- a/generic/itclIntDecls.h +++ b/generic/itclIntDecls.h @@ -5,10 +5,6 @@ #ifndef _ITCLINTDECLS #define _ITCLINTDECLS -#if !defined(Tcl_Size) -# define Tcl_Size int -#endif - /* !BEGIN!: Do not edit below this line. */ #define ITCLINT_STUBS_EPOCH 0 diff --git a/generic/itclMigrate2TclCore.h b/generic/itclMigrate2TclCore.h index ccbe7079..14bd70ec 100644 --- a/generic/itclMigrate2TclCore.h +++ b/generic/itclMigrate2TclCore.h @@ -39,15 +39,9 @@ typedef struct Tcl_ResolvedVarInfo { Tcl_ResolveVarDeleteProc *deleteProc; } Tcl_ResolvedVarInfo; -#if TCL_MAJOR_VERSION > 8 typedef int (Tcl_ResolveCompiledVarProc) (Tcl_Interp *interp, - const char *name, size_t length, Tcl_Namespace *context, + const char *name, Tcl_Size length, Tcl_Namespace *context, Tcl_ResolvedVarInfo **rPtr); -#else -typedef int (Tcl_ResolveCompiledVarProc) (Tcl_Interp *interp, - const char *name, int length, Tcl_Namespace *context, - Tcl_ResolvedVarInfo **rPtr); -#endif typedef int (Tcl_ResolveVarProc) (Tcl_Interp *interp, const char *name, Tcl_Namespace *context, int flags, Tcl_Var *rPtr);