From ad983c6d746da6b31a177f9137e0f0fd1b4b46f9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Mar 2022 13:40:05 +0000 Subject: Don't bother UINT2PTR, since INT2PTR is just as good. --- generic/tclHash.c | 2 +- generic/tclInt.h | 13 ++++++++----- win/tclWinThrd.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/generic/tclHash.c b/generic/tclHash.c index fa30cee..7538821 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -354,7 +354,7 @@ CreateHashEntry( } hPtr->tablePtr = tablePtr; - hPtr->hash = UINT2PTR(hash); + hPtr->hash = INT2PTR(hash); hPtr->nextPtr = tablePtr->buckets[index]; tablePtr->buckets[index] = hPtr; tablePtr->numEntries++; diff --git a/generic/tclInt.h b/generic/tclInt.h index 3f2d1ad..af839fc 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -128,21 +128,24 @@ typedef int ptrdiff_t; * to/from pointer from/to integer of different size". */ -#if !defined(INT2PTR) && !defined(PTR2INT) +#if !defined(INT2PTR) # if defined(HAVE_INTPTR_T) || defined(intptr_t) # define INT2PTR(p) ((void *)(intptr_t)(p)) -# define PTR2INT(p) ((intptr_t)(p)) # else # define INT2PTR(p) ((void *)(p)) +# endif +#endif +#if !defined(PTR2INT) +# if defined(HAVE_INTPTR_T) || defined(intptr_t) +# define PTR2INT(p) ((intptr_t)(p)) +# else # define PTR2INT(p) ((long)(p)) # endif #endif -#if !defined(UINT2PTR) && !defined(PTR2UINT) +#if !defined(PTR2UINT) # if defined(HAVE_UINTPTR_T) || defined(uintptr_t) -# define UINT2PTR(p) ((void *)(uintptr_t)(p)) # define PTR2UINT(p) ((uintptr_t)(p)) # else -# define UINT2PTR(p) ((void *)(p)) # define PTR2UINT(p) ((unsigned long)(p)) # endif #endif diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 86db837..b69fbfc 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -326,7 +326,7 @@ TclpThreadExit( Tcl_ThreadId Tcl_GetCurrentThread(void) { - return (Tcl_ThreadId)(size_t)GetCurrentThreadId(); + return (Tcl_ThreadId)INT2PTR(GetCurrentThreadId()); } /* -- cgit v0.12