summaryrefslogtreecommitdiffstats
path: root/unix/tclLoadOSF.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-19 08:59:56 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-07-19 08:59:56 (GMT)
commitc444c608df624587909b00a2dd705639d77ee3c5 (patch)
treed032c10b4c13ff0c84ac17479550d303371f0a9c /unix/tclLoadOSF.c
parente3a6968b93006d08f0e1dd834826e5f4b37fbd1a (diff)
parent2e4dede38726df20d789751af9b335c2b4ab6e96 (diff)
downloadtcl-c444c608df624587909b00a2dd705639d77ee3c5.zip
tcl-c444c608df624587909b00a2dd705639d77ee3c5.tar.gz
tcl-c444c608df624587909b00a2dd705639d77ee3c5.tar.bz2
Merge 9.0
Diffstat (limited to 'unix/tclLoadOSF.c')
-rw-r--r--unix/tclLoadOSF.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/unix/tclLoadOSF.c b/unix/tclLoadOSF.c
index 852adca..79a869b 100644
--- a/unix/tclLoadOSF.c
+++ b/unix/tclLoadOSF.c
@@ -36,16 +36,17 @@
#include <sys/types.h>
#include <loader.h>
+
/*
- * Static functions defined within this file.
+ * Static procedures defined within this file.
*/
static void * FindSymbol(Tcl_Interp *interp,
- Tcl_LoadHandle loadHandle, const char* symbol);
-static void UnloadFile(Tcl_LoadHandle handle);
+ Tcl_LoadHandle loadHandle, const char *symbol);
+static void UnloadFile(Tcl_LoadHandle loadHandle);
/*
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*
* TclpDlopen --
*
@@ -53,13 +54,13 @@ static void UnloadFile(Tcl_LoadHandle handle);
* to the new code.
*
* Results:
- * A standard Tcl completion code. If an error occurs, an error message
+ * A standard Tcl completion code. If an error occurs, an error message
* is left in the interp's result.
*
* Side effects:
* New code suddenly appears in memory.
*
- *----------------------------------------------------------------------
+ *---------------------------------------------------------------------------
*/
int
@@ -83,7 +84,7 @@ TclpDlopen(
const char *native;
/*
- * First try the full path the user gave us. This is particularly
+ * First try the full path the user gave us. This is particularly
* important if the cwd is inside a vfs, and we are trying to load using a
* relative path.
*/
@@ -100,7 +101,11 @@ TclpDlopen(
Tcl_DString ds;
- native = Tcl_UtfToExternalDString(NULL, fileName, TCL_INDEX_NONE, &ds);
+ if (Tcl_UtfToExternalDStringEx(interp, NULL, fileName, TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
+ Tcl_DStringFree(&ds);
+ return TCL_ERROR;
+ }
+ native = Tcl_DStringValue(&ds);
lm = (Tcl_LibraryInitProc *) load(native, LDR_NOFLAGS);
Tcl_DStringFree(&ds);
}
@@ -132,8 +137,9 @@ TclpDlopen(
newHandle->clientData = pkg;
newHandle->findSymbolProcPtr = &FindSymbol;
newHandle->unloadFileProcPtr = &UnloadFile;
- *loadHandle = newHandle;
*unloadProcPtr = &UnloadFile;
+ *loadHandle = newHandle;
+
return TCL_OK;
}
@@ -147,7 +153,7 @@ TclpDlopen(
*
* Results:
* Returns a pointer to the function associated with 'symbol' if it is
- * found. Otherwise returns NULL and may leave an error message in the
+ * found. Otherwise returns NULL and may leave an error message in the
* interp's result.
*
*----------------------------------------------------------------------
@@ -159,14 +165,14 @@ FindSymbol(
Tcl_LoadHandle loadHandle,
const char *symbol)
{
- void *retval = ldr_lookup_package((char *) loadHandle, symbol);
+ void *proc = ldr_lookup_package((char *) loadHandle, symbol);
- if (retval == NULL && interp != NULL) {
+ if (proc == NULL && interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"cannot find symbol \"%s\"", symbol));
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol, NULL);
}
- return retval;
+ return proc;
}
/*