summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--unix/tclLoadDl.c29
-rw-r--r--unix/tclLoadDyld.c5
3 files changed, 24 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a95f2a..f9403d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,12 @@
+2010-04-05 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tclLoadDyld.c (FindSymbol): Better human-readable error message
+ generation to match code in tclLoadDl.c.
+
2010-04-04 Donal K. Fellows <dkf@users.sf.net>
- * generic/tclIOUtil.c: Minor changes to enforce Engineering Manual
- style rules.
+ * generic/tclIOUtil.c, unix/tclLoadDl.c: Minor changes to enforce
+ Engineering Manual style rules.
* doc/FileSystem.3, doc/Load.3: Documentation for TIP#357.
diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c
index 802e0dd..0620bd3 100644
--- a/unix/tclLoadDl.c
+++ b/unix/tclLoadDl.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoadDl.c,v 1.20 2010/04/02 21:21:06 kennykb Exp $
+ * RCS: @(#) $Id: tclLoadDl.c,v 1.21 2010/04/05 07:38:08 dkf Exp $
*/
#include "tclInt.h"
@@ -34,11 +34,13 @@
# define RTLD_GLOBAL 0
#endif
-/* Static procedures 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 loadHandle);
+static void * FindSymbol(Tcl_Interp *interp,
+ Tcl_LoadHandle loadHandle, const char *symbol);
+static void UnloadFile(Tcl_LoadHandle loadHandle);
/*
*---------------------------------------------------------------------------
@@ -144,7 +146,7 @@ FindSymbol(
{
const char *native;
Tcl_DString newName, ds;
- void *handle = (void *)(loadHandle->clientData);
+ void *handle = (void *) loadHandle->clientData;
Tcl_PackageInitProc *proc;
/*
@@ -154,23 +156,21 @@ FindSymbol(
*/
native = Tcl_UtfToExternalDString(NULL, symbol, -1, &ds);
- proc = (Tcl_PackageInitProc *) dlsym(handle, /* INTL: Native. */
- native);
+ proc = (Tcl_PackageInitProc *) dlsym(handle, native); /* INTL: Native. */
if (proc == NULL) {
Tcl_DStringInit(&newName);
Tcl_DStringAppend(&newName, "_", 1);
native = Tcl_DStringAppend(&newName, native, -1);
- proc = (Tcl_PackageInitProc *) dlsym(handle, /* INTL: Native. */
- native);
+ proc = (Tcl_PackageInitProc *) dlsym(handle, native); /* INTL: Native. */
Tcl_DStringFree(&newName);
}
Tcl_DStringFree(&ds);
if (proc == NULL && interp != NULL) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "cannot find symbol \"", symbol, "\": ",
- dlerror(), NULL);
+ dlerror(), NULL);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol,
- NULL);
+ NULL);
}
return proc;
}
@@ -199,11 +199,10 @@ UnloadFile(
* TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
- void *handle;
+ void *handle = (void *) loadHandle->clientData;
- handle = (void *)(loadHandle->clientData);
dlclose(handle);
- ckfree((char*)loadHandle);
+ ckfree((char *) loadHandle);
}
/*
diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c
index bfdcc00..35f732d 100644
--- a/unix/tclLoadDyld.c
+++ b/unix/tclLoadDyld.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoadDyld.c,v 1.36 2010/04/02 22:52:26 dkf Exp $
+ * RCS: @(#) $Id: tclLoadDyld.c,v 1.37 2010/04/05 07:38:08 dkf Exp $
*/
#include "tclInt.h"
@@ -452,7 +452,8 @@ FindSymbol(
}
Tcl_DStringFree(&ds);
if (errMsg && (interp != NULL)) {
- Tcl_AppendResult(interp, errMsg, NULL);
+ Tcl_AppendResult(interp, "cannot find symbol \"", symbol, "\": ",
+ errMsg, NULL);
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "LOAD_SYMBOL", symbol,
NULL);
}