Update of /cvsroot/naviserver/naviserver/nsd
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24749/nsd
Modified Files:
modload.c
Log Message:
* nsd/modload.c (Ns_ModuleLoad): Quiet compiler complaints about
pointer aliasing. Allocate interp from per-thread cache.
Index: modload.c
===================================================================
RCS file: /cvsroot/naviserver/naviserver/nsd/modload.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** modload.c 8 Oct 2005 12:06:07 -0000 1.4
--- modload.c 9 Oct 2005 05:41:44 -0000 1.5
***************
*** 141,166 ****
CONST char *init)
{
Ns_ModuleInitProc *initProc = NULL;
int status, *verPtr = NULL;
! Tcl_Obj *path;
Tcl_Interp *interp;
Tcl_LoadHandle lh;
! Tcl_FSUnloadFileProc *uPtr = NULL;
Ns_Log(Notice, "modload: loading %s", file);
! path = Tcl_NewStringObj(file, -1);
! Tcl_IncrRefCount(path);
! if (Tcl_FSGetNormalizedPath(NULL, path) == NULL) {
! Tcl_DecrRefCount(path);
Ns_Log(Error, "modload: %s: invalid path", file);
return NS_ERROR;
}
! interp = Tcl_CreateInterp();
! status = Tcl_FSLoadFile(interp, path, init, "Ns_ModuleVersion",
! (Tcl_PackageInitProc**)&initProc,
! (Tcl_PackageInitProc**)&verPtr, &lh, &uPtr);
! Tcl_DecrRefCount(path);
if (status != TCL_OK) {
Ns_Log(Error, "modload: %s: %s", file, Tcl_GetStringResult(interp));
--- 141,170 ----
CONST char *init)
{
+ Tcl_PackageInitProc *tclInitProc = NULL, *tclVerProc = NULL;
Ns_ModuleInitProc *initProc = NULL;
int status, *verPtr = NULL;
! Tcl_Obj *pathObj;
Tcl_Interp *interp;
Tcl_LoadHandle lh;
! Tcl_FSUnloadFileProc *uPtr;
Ns_Log(Notice, "modload: loading %s", file);
! pathObj = Tcl_NewStringObj(file, -1);
! Tcl_IncrRefCount(pathObj);
! if (Tcl_FSGetNormalizedPath(NULL, pathObj) == NULL) {
! Tcl_DecrRefCount(pathObj);
Ns_Log(Error, "modload: %s: invalid path", file);
return NS_ERROR;
}
! interp = Ns_TclAllocateInterp(server);
! if (interp == NULL) {
! Ns_Log(Error, "modload: invalid server name: '%s'", server);
! return NS_ERROR;
! }
! status = Tcl_FSLoadFile(interp, pathObj, init, "Ns_ModuleVersion",
! &tclInitProc, &tclVerProc, &lh, &uPtr);
! Tcl_DecrRefCount(pathObj);
if (status != TCL_OK) {
Ns_Log(Error, "modload: %s: %s", file, Tcl_GetStringResult(interp));
***************
*** 168,172 ****
return NS_ERROR;
}
! Tcl_DeleteInterp(interp);
if (initProc == NULL) {
Ns_Log(Error, "modload: %s: %s: symbol not found", file, init);
--- 172,180 ----
return NS_ERROR;
}
! Ns_TclDeAllocateInterp(interp);
!
! initProc = (Ns_ModuleInitProc *) tclInitProc;
! verPtr = (int *) tclVerProc;
!
if (initProc == NULL) {
Ns_Log(Error, "modload: %s: %s: symbol not found", file, init);
|