summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-10-11 09:45:45 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-10-11 09:45:45 (GMT)
commit76c89fce6cae52d0fbdbba1ff0c412f73e7985e9 (patch)
tree42d3c2474078cdab8f39c4925c5b0237ab81b66e
parenta74d73bc13dd4961d02d3974912000145bff5d1a (diff)
parenta64802e7ede7f1794273c96ae87b61920c268964 (diff)
downloadtcl-76c89fce6cae52d0fbdbba1ff0c412f73e7985e9.zip
tcl-76c89fce6cae52d0fbdbba1ff0c412f73e7985e9.tar.gz
tcl-76c89fce6cae52d0fbdbba1ff0c412f73e7985e9.tar.bz2
Fix [8ab8a138c9]: Functions passed to Tcl_EventuallyFree() must be declared/defined as Tcl_FreeProc
-rw-r--r--generic/tclBasic.c17
-rw-r--r--generic/tclDecls.h6
-rw-r--r--generic/tclIORChan.c9
-rw-r--r--generic/tclIORTrans.c17
-rw-r--r--generic/tclTest.c14
5 files changed, 40 insertions, 23 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 9d84de2..8dde621 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -7,10 +7,10 @@
*
* Copyright (c) 1987-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-1999 by Scriptics Corporation.
- * Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
+ * Copyright (c) 2001, 2002 Kevin B. Kenny. All rights reserved.
* Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2006-2008 by Joe Mistachkin. All rights reserved.
+ * Copyright (c) 2006-2008 Joe Mistachkin. All rights reserved.
* Copyright (c) 2008 Miguel Sofer <msofer@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
@@ -44,7 +44,7 @@
void *
TclGetCStackPtr(void)
{
-#if __GNUC__ || __has_builtin(__builtin_frame_address)
+#if defined( __GNUC__ ) || __has_builtin(__builtin_frame_address)
return __builtin_frame_address(0);
#elif defined(_MSC_VER) && defined(HAVE_INTRIN_H)
return _AddressOfReturnAddress();
@@ -106,7 +106,7 @@ typedef struct {
} CancelInfo;
static Tcl_HashTable cancelTable;
static int cancelTableInitialized = 0; /* 0 means not yet initialized. */
-TCL_DECLARE_MUTEX(cancelLock)
+TCL_DECLARE_MUTEX(cancelLock);
/*
* Declarations for managing contexts for non-recursive coroutines. Contexts
@@ -136,7 +136,7 @@ static int CancelEvalProc(ClientData clientData,
Tcl_Interp *interp, int code);
static int CheckDoubleResult(Tcl_Interp *interp, double dResult);
static void DeleteCoroutine(ClientData clientData);
-static void DeleteInterpProc(Tcl_Interp *interp);
+static Tcl_FreeProc DeleteInterpProc;
static void DeleteOpCmdClientData(ClientData clientData);
#ifdef USE_DTRACE
static Tcl_ObjCmdProc DTraceObjCmd;
@@ -1392,7 +1392,7 @@ Tcl_DeleteInterp(
* Ensure that the interpreter is eventually deleted.
*/
- Tcl_EventuallyFree(interp, (Tcl_FreeProc *) DeleteInterpProc);
+ Tcl_EventuallyFree(interp, DeleteInterpProc);
}
/*
@@ -1418,8 +1418,9 @@ Tcl_DeleteInterp(
static void
DeleteInterpProc(
- Tcl_Interp *interp) /* Interpreter to delete. */
+ char *blockPtr) /* Interpreter to delete. */
{
+ Tcl_Interp *interp = (Tcl_Interp *) blockPtr;
Interp *iPtr = (Interp *) interp;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 8a226a9..f8e9bcf 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -3973,6 +3973,12 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_SetVar(interp, varName, newValue, flags))
# define Tcl_ObjSetVar2(interp, part1, part2, newValue, flags) \
(tclStubsPtr->tcl_ObjSetVar2(interp, part1, part2, newValue, flags))
+# undef Tcl_EventuallyFree
+# define Tcl_EventuallyFree \
+ ((void (*)(void *,void *))(void *)(tclStubsPtr->tcl_EventuallyFree)) /* 132 */
+# undef Tcl_SetResult
+# define Tcl_SetResult \
+ ((void (*)(Tcl_Interp *, char *, void *))(void *)(tclStubsPtr->tcl_SetResult)) /* 232 */
#endif
#if defined(_WIN32) && defined(UNICODE)
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 3eca3f8..69a8e11 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -430,7 +430,7 @@ static Tcl_Obj * DecodeEventMask(int mask);
static ReflectedChannel * NewReflectedChannel(Tcl_Interp *interp,
Tcl_Obj *cmdpfxObj, int mode, Tcl_Obj *handleObj);
static Tcl_Obj * NextHandle(void);
-static void FreeReflectedChannel(ReflectedChannel *rcPtr);
+static Tcl_FreeProc FreeReflectedChannel;
static int InvokeTclMethod(ReflectedChannel *rcPtr,
MethodName method, Tcl_Obj *argOneObj,
Tcl_Obj *argTwoObj, Tcl_Obj **resultObjPtr);
@@ -1170,7 +1170,7 @@ ReflectClose(
ckfree((char *)tctPtr);
((Channel *)rcPtr->chan)->typePtr = NULL;
}
- Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel);
+ Tcl_EventuallyFree(rcPtr, FreeReflectedChannel);
return EOK;
}
@@ -1239,7 +1239,7 @@ ReflectClose(
ckfree((char *)tctPtr);
((Channel *)rcPtr->chan)->typePtr = NULL;
}
- Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel);
+ Tcl_EventuallyFree(rcPtr, FreeReflectedChannel);
return (result == TCL_OK) ? EOK : EINVAL;
}
@@ -2210,8 +2210,9 @@ NextHandle(void)
static void
FreeReflectedChannel(
- ReflectedChannel *rcPtr)
+ char *blockPtr)
{
+ ReflectedChannel *rcPtr = (ReflectedChannel *) blockPtr;
Channel *chanPtr = (Channel *) rcPtr->chan;
TclChannelRelease((Tcl_Channel)chanPtr);
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c
index 730820e..bc0e20c 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -417,7 +417,7 @@ static ReflectedTransform * NewReflectedTransform(Tcl_Interp *interp,
Tcl_Obj *cmdpfxObj, int mode, Tcl_Obj *handleObj,
Tcl_Channel parentChan);
static Tcl_Obj * NextHandle(void);
-static void FreeReflectedTransform(ReflectedTransform *rtPtr);
+static Tcl_FreeProc FreeReflectedTransform;
static void FreeReflectedTransformArgs(ReflectedTransform *rtPtr);
static int InvokeTclMethod(ReflectedTransform *rtPtr,
const char *method, Tcl_Obj *argOneObj,
@@ -718,7 +718,7 @@ TclChanPushObjCmd(
* structure.
*/
- Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *) FreeReflectedTransform);
+ Tcl_EventuallyFree(rtPtr, FreeReflectedTransform);
return TCL_ERROR;
#undef CHAN
@@ -924,7 +924,7 @@ ReflectClose(
}
#endif /* TCL_THREADS */
- Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *) FreeReflectedTransform);
+ Tcl_EventuallyFree(rtPtr, FreeReflectedTransform);
return EOK;
}
@@ -941,7 +941,7 @@ ReflectClose(
#ifdef TCL_THREADS
if (rtPtr->thread != Tcl_GetCurrentThread()) {
Tcl_EventuallyFree(rtPtr,
- (Tcl_FreeProc *) FreeReflectedTransform);
+ FreeReflectedTransform);
return errorCode;
}
#endif /* TCL_THREADS */
@@ -955,7 +955,7 @@ ReflectClose(
#ifdef TCL_THREADS
if (rtPtr->thread != Tcl_GetCurrentThread()) {
Tcl_EventuallyFree(rtPtr,
- (Tcl_FreeProc *) FreeReflectedTransform);
+ FreeReflectedTransform);
return errorCode;
}
#endif /* TCL_THREADS */
@@ -975,7 +975,7 @@ ReflectClose(
ForwardOpToOwnerThread(rtPtr, ForwardedClose, &p);
result = p.base.code;
- Tcl_EventuallyFree(rtPtr, (Tcl_FreeProc *) FreeReflectedTransform);
+ Tcl_EventuallyFree(rtPtr, FreeReflectedTransform);
if (result != TCL_OK) {
PassReceivedErrorInterp(interp, &p);
@@ -1034,7 +1034,7 @@ ReflectClose(
#endif /* TCL_THREADS */
}
- Tcl_EventuallyFree (rtPtr, (Tcl_FreeProc *) FreeReflectedTransform);
+ Tcl_EventuallyFree(rtPtr, FreeReflectedTransform);
return errorCodeSet ? errorCode : ((result == TCL_OK) ? EOK : EINVAL);
}
@@ -1920,8 +1920,9 @@ FreeReflectedTransformArgs(
static void
FreeReflectedTransform(
- ReflectedTransform *rtPtr)
+ char *blockPtr)
{
+ ReflectedTransform *rtPtr = (ReflectedTransform *) blockPtr;
TimerKill(rtPtr);
ResultClear(&rtPtr->result);
diff --git a/generic/tclTest.c b/generic/tclTest.c
index d05ef7d..ea23d40 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -204,7 +204,7 @@ static int ObjTraceProc(ClientData clientData,
Tcl_Obj *const objv[]);
static void ObjTraceDeleteProc(ClientData clientData);
static void PrintParse(Tcl_Interp *interp, Tcl_Parse *parsePtr);
-static void SpecialFree(char *blockPtr);
+static Tcl_FreeProc SpecialFree;
static int StaticInitProc(Tcl_Interp *interp);
static Tcl_CmdProc TestasyncCmd;
static Tcl_ObjCmdProc TestbumpinterpepochObjCmd;
@@ -265,7 +265,7 @@ static Tcl_ObjCmdProc TestreturnObjCmd;
static void TestregexpXflags(const char *string,
int length, int *cflagsPtr, int *eflagsPtr);
static Tcl_ObjCmdProc TestsaveresultCmd;
-static void TestsaveresultFree(char *blockPtr);
+static Tcl_FreeProc TestsaveresultFree;
static Tcl_CmdProc TestsetassocdataCmd;
static Tcl_CmdProc TestsetCmd;
static Tcl_CmdProc Testset2Cmd;
@@ -1811,9 +1811,13 @@ TestdstringCmd(
*/
static void SpecialFree(
+#if TCL_MAJOR_VERSION > 8
+ void *blockPtr /* Block to free. */
+#else
char *blockPtr /* Block to free. */
+#endif
) {
- ckfree(blockPtr - 16);
+ ckfree((char *)blockPtr - 16);
}
/*
@@ -5489,7 +5493,11 @@ TestsaveresultCmd(
static void
TestsaveresultFree(
+#if TCL_MAJOR_VERSION > 8
+ void *blockPtr)
+#else
char *blockPtr)
+#endif
{
freeCount++;
}