diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-09-28 08:22:08 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-09-28 08:22:08 (GMT) |
| commit | b815eeaea11da76d03de06dd072020a67df50849 (patch) | |
| tree | 7e0cf9107eb484d9f50339c5c4862b22cb5f7a4a /unix/tclLoadNext.c | |
| parent | 46892ac925872ac5eee1bd52e1a04df88871c577 (diff) | |
| parent | 2d8f75bb449a9a3fd3de32a2a8e009ce10a1709c (diff) | |
| download | tcl-b815eeaea11da76d03de06dd072020a67df50849.zip tcl-b815eeaea11da76d03de06dd072020a67df50849.tar.gz tcl-b815eeaea11da76d03de06dd072020a67df50849.tar.bz2 | |
Rebase to 9.0
Diffstat (limited to 'unix/tclLoadNext.c')
| -rw-r--r-- | unix/tclLoadNext.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/unix/tclLoadNext.c b/unix/tclLoadNext.c index 23de2c5..527e893 100644 --- a/unix/tclLoadNext.c +++ b/unix/tclLoadNext.c @@ -14,14 +14,17 @@ #include <mach-o/rld.h> #include <streams/streams.h> -/* Static procedures defined within this file */ + +/* + * Static procedures defined within this file. + */ static void * FindSymbol(Tcl_Interp *interp, - Tcl_LoadHandle loadHandle, const char* symbol); + Tcl_LoadHandle loadHandle, const char *symbol); static void UnloadFile(Tcl_LoadHandle loadHandle); /* - *---------------------------------------------------------------------- + *--------------------------------------------------------------------------- * * TclpDlopen -- * @@ -29,13 +32,13 @@ static void UnloadFile(Tcl_LoadHandle loadHandle); * 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 @@ -78,12 +81,16 @@ TclpDlopen( /* * Let the OS loader examine the binary search path for whatever * string the user gave us which hopefully refers to a file on the - * binary path + * binary path. */ 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); files = {native,NULL}; result = rld_load(errorStream, &header, files, NULL); Tcl_DStringFree(&ds); @@ -101,12 +108,12 @@ TclpDlopen( } NXCloseMemory(errorStream, NX_FREEBUFFER); - newHandle = (Tcl_LoadHandle) Tcl_Alloc(sizeof(*newHandle)); + newHandle = (Tcl_LoadHandle)Tcl_Alloc(sizeof(*newHandle)); newHandle->clientData = INT2PTR(1); newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; - *loadHandle = newHandle; *unloadProcPtr = &UnloadFile; + *loadHandle = newHandle; return TCL_OK; } @@ -169,7 +176,7 @@ FindSymbol( *---------------------------------------------------------------------- */ -void +static void UnloadFile( Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to * TclpDlopen(). The loadHandle is a token |
