From 9fb523117884acb452a530daf5fa93a9d2f41cb2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 9 Oct 2023 20:37:52 +0000 Subject: [PATCH 1/2] Fix [d0d0749467]: TclFSUnloadTempFile() is unused --- generic/tclIOUtil.c | 93 --------------------------------------------- generic/tclInt.h | 1 - 2 files changed, 94 deletions(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index ca11172548d..a4febaa9f8a 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -3695,99 +3695,6 @@ Tcl_FSUnloadFile( return TCL_OK; } -/* - *---------------------------------------------------------------------- - * - * TclFSUnloadTempFile -- - * - * This function is called when we loaded a library of code via an - * intermediate temporary file. This function ensures the library is - * correctly unloaded and the temporary file is correctly deleted. - * - * Results: - * None. - * - * Side effects: - * The effects of the 'unload' function called, and of course the - * temporary file will be deleted. - * - *---------------------------------------------------------------------- - */ - -void -TclFSUnloadTempFile( - Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to - * Tcl_FSLoadFile(). The loadHandle is a token - * that represents the loaded file. */ -{ - FsDivertLoad *tvdlPtr = (FsDivertLoad *) loadHandle; - - /* - * This test should never trigger, since we give the client data in the - * function above. - */ - - if (tvdlPtr == NULL) { - return; - } - - /* - * Call the real 'unloadfile' proc we actually used. It is very important - * that we call this first, so that the shared library is actually - * unloaded by the OS. Otherwise, the following 'delete' may well fail - * because the shared library is still in use. - */ - - if (tvdlPtr->unloadProcPtr != NULL) { - tvdlPtr->unloadProcPtr(tvdlPtr->loadHandle); - } - - if (tvdlPtr->divertedFilesystem == NULL) { - /* - * It was the native filesystem, and we have a special function - * available just for this purpose, which we know works even at this - * late stage. - */ - - TclpDeleteFile(tvdlPtr->divertedFileNativeRep); - NativeFreeInternalRep(tvdlPtr->divertedFileNativeRep); - } else { - /* - * Remove the temporary file we created. Note, we may crash here - * because encodings have been taken down already. - */ - - if (tvdlPtr->divertedFilesystem->deleteFileProc(tvdlPtr->divertedFile) - != TCL_OK) { - /* - * The above may have failed because the filesystem, or something - * it depends upon (e.g. encodings) have been taken down because - * Tcl is exiting. - * - * We may need to work out how to delete this file more robustly - * (or give the filesystem the information it needs to delete the - * file more robustly). - * - * In particular, one problem might be that the filesystem cannot - * extract the information it needs from the above path object - * because Tcl's entire filesystem apparatus (the code in this - * file) has been finalized, and it refuses to pass the internal - * representation to the filesystem. - */ - } - - /* - * And free up the allocations. This will also of course remove a - * refCount from the Tcl_Filesystem to which this file belongs, which - * could then free up the filesystem if we are exiting. - */ - - Tcl_DecrRefCount(tvdlPtr->divertedFile); - } - - ckfree(tvdlPtr); -} - /* *--------------------------------------------------------------------------- * diff --git a/generic/tclInt.h b/generic/tclInt.h index 9993440ce3e..4d28dbee0cf 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2970,7 +2970,6 @@ MODULE_SCOPE Tcl_Command TclNRCreateCommandInNs(Tcl_Interp *interp, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *encodingName); -MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle); MODULE_SCOPE int * TclGetAsyncReadyPtr(void); MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp); MODULE_SCOPE int TclGetChannelFromObj(Tcl_Interp *interp, From a74d73bc13dd4961d02d3974912000145bff5d1a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 9 Oct 2023 20:39:27 +0000 Subject: [PATCH 2/2] Fix [db537f8809]: tclInt.h: TclNsDecrRefCount() declaration duplicated --- generic/tclInt.h | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 4d28dbee0cf..103827fe8f3 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3043,7 +3043,6 @@ MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc, MODULE_SCOPE Tcl_Obj * TclNoErrorStack(Tcl_Interp *interp, Tcl_Obj *options); MODULE_SCOPE int TclNokia770Doubles(void); MODULE_SCOPE void TclNsDecrRefCount(Namespace *nsPtr); -MODULE_SCOPE void TclNsDecrRefCount(Namespace *nsPtr); MODULE_SCOPE int TclNamespaceDeleted(Namespace *nsPtr); MODULE_SCOPE void TclObjVarErrMsg(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const char *operation,