You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-cvs@tcl.apache.org by ro...@apache.org on 2002/07/25 12:10:24 UTC

cvs commit: tcl-websh/src/generic cfg.c cfg.h interpool.c request.c request.h web.c

ronnie      2002/07/25 03:10:23

  Modified:    src/generic cfg.c cfg.h interpool.c request.c request.h
                        web.c
  Log:
  - removed the temp hack for the memory leak
    caused by Tcl_CreateThreadeExitHandler
  - removed test code from initpool.c
  - fixed memory leak temporarily (added fixme)
  
  Revision  Changes    Path
  1.13      +8 -10     tcl-websh/src/generic/cfg.c
  
  Index: cfg.c
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/cfg.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- cfg.c	24 Jul 2002 22:30:39 -0000	1.12
  +++ cfg.c	25 Jul 2002 10:10:22 -0000	1.13
  @@ -18,19 +18,16 @@
   #include "request.h"
   #include "crypt.h"
   
  -void dCfgData(ClientData clientData);
  -
  -void dCfgData(ClientData clientData)
  +/*void dCfgData(ClientData clientData)
   {
  -
       destroyCfgData(clientData, NULL);
  -}
  +}*/
   
   
   /* ----------------------------------------------------------------------------
    * Init --
    * ------------------------------------------------------------------------- */
  -int cfg_Init(Tcl_Interp * interp, int initial)
  +int cfg_Init(Tcl_Interp * interp)
   {
   
       CfgData *cfgData;
  @@ -60,10 +57,11 @@
   		     destroyCfgData, (ClientData) cfgData);
   
       /* -------------------------------------------------------------------------
  -     * need an exit handler, too (if this is the main interp)
  +     * need an exit handler too (if this is the main interp)
        * ---------------------------------------------------------------------- */
  -    if (initial)
  -	Tcl_CreateThreadExitHandler(dCfgData, (ClientData) cfgData);
  +    /*fixme: do we really need this? (it's leaking memory) */
  +    /* if (Tcl_GetMaster(interp) == NULL)
  +       Tcl_CreateThreadExitHandler(dCfgData, (ClientData) cfgData);*/
   
       /* -------------------------------------------------------------------------
        * done
  
  
  
  1.5       +4 -2      tcl-websh/src/generic/cfg.h
  
  Index: cfg.h
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/cfg.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- cfg.h	24 Jul 2002 22:30:39 -0000	1.4
  +++ cfg.h	25 Jul 2002 10:10:22 -0000	1.5
  @@ -39,10 +39,12 @@
   CfgData;
   
   
  +/*void dCfgData(ClientData clientData);*/
  +
   CfgData *createCfgData(Tcl_Interp * interp);
   void destroyCfgData(ClientData clientData, Tcl_Interp * interp);
   
  -int cfg_Init(Tcl_Interp * interp, int initial);
  +int cfg_Init(Tcl_Interp * interp);
   
   int Web_Cfg(ClientData clientData,
   	    Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]);
  
  
  
  1.16      +2 -39     tcl-websh/src/generic/interpool.c
  
  Index: interpool.c
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/interpool.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- interpool.c	24 Jul 2002 23:13:43 -0000	1.15
  +++ interpool.c	25 Jul 2002 10:10:22 -0000	1.16
  @@ -121,9 +121,7 @@
       /* now register here all websh modules */
       result = Tcl_Init(webInterp->interp);
       /* checkme: test result */
  -
  -    /* fixme: do it w/o initial */
  -    result = Websh_Init(webInterp->interp, 0);
  +    result = Websh_Init(webInterp->interp);
   
       /* also register the destrcutor, etc. functions, passing webInterp as
          client data */
  @@ -302,10 +300,6 @@
   
       Tcl_MutexLock(&(conf->mainInterpLock));
   
  -/*
  -Tcl_Eval(conf->mainInterp, "memory active /home/ronnie/websh/[clock seconds].pre");
  -*/
  -
       mapCmd = Tcl_NewStringObj("web::interpmap ", -1);
       Tcl_IncrRefCount(mapCmd);
       Tcl_AppendToObj(mapCmd, filename, -1);
  @@ -485,12 +479,6 @@
   	/* cleanup all EXPIRED interps */
   	cleanupPool(webInterpClass->conf);
   
  -/*
  -Tcl_MutexLock(&(webInterpClass->conf->mainInterpLock));
  -Tcl_Eval(webInterpClass->conf->mainInterp, "memory active /home/ronnie/websh/[clock seconds].post");
  -Tcl_MutexUnlock(&(webInterpClass->conf->mainInterpLock));
  -*/
  -
   	Tcl_MutexUnlock(&(webInterpClass->conf->webshPoolLock));
   
       }
  @@ -529,28 +517,6 @@
   	return 0;
       }
   
  -    /* create one interp to initialize the exit handlers properly */
  -    {
  -      Tcl_Interp* interp = NULL;
  -      interp = Tcl_CreateInterp();
  -      if (interp != NULL) {
  -	/* checkme: we should really check the results here ... */
  -	Tcl_Init(interp);
  -	/*fixme: do it with initial ... */
  -	Websh_Init(interp);
  -	Tcl_DeleteInterp(interp);
  -      } else {
  -	errno = 0;
  -#ifndef APACHE2
  -	ap_log_printf(conf->server, "could'nt create initial interp\n");
  -#else /* APACHE2 */
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, conf->server,
  -		     "could'nt create initial interp\n");
  -#endif /* APACHE2 */
  -	return 0;
  -      }
  -    }
  -    
       /* create our table of interp classes */
       HashUtlAllocInit(conf->webshPool, TCL_STRING_KEYS);
   
  @@ -606,9 +572,6 @@
   	return NULL;
       }
   
  -/*
  -Tcl_InitMemory(mainInterp);
  -*/
       /* register Log Module in here */
       if (log_Init(mainInterp) == TCL_ERROR) {
   	Tcl_DeleteInterp(mainInterp);
  
  
  
  1.14      +9 -8      tcl-websh/src/generic/request.c
  
  Index: request.c
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/request.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- request.c	24 Jul 2002 22:30:39 -0000	1.13
  +++ request.c	25 Jul 2002 10:10:22 -0000	1.14
  @@ -25,16 +25,15 @@
   #  include <time.h>
   #endif
   
  -void dRequestData(ClientData clientData)
  +/*void dRequestData(ClientData clientData)
   {
  -
       destroyRequestData(clientData, NULL);
  -}
  +}*/
   
   /* ----------------------------------------------------------------------------
    * Init --
    * ------------------------------------------------------------------------- */
  -int request_Init(Tcl_Interp * interp, int initial)
  +int request_Init(Tcl_Interp * interp)
   {
   
       RequestData *requestData;
  @@ -83,10 +82,12 @@
   		     destroyRequestData, (ClientData) requestData);
   
       /* -------------------------------------------------------------------------
  -     * need an exit handler, too (if this is the main interp)
  +     * need an exit handler too (if this is the main interp)
        * ---------------------------------------------------------------------- */
  -    if (initial)
  -      Tcl_CreateThreadExitHandler(dRequestData, (ClientData) requestData);
  +    /*fixme: do we really need this? (it's leaking memory) */
  +    /*if (Tcl_GetMaster(interp) == NULL)
  +      Tcl_CreateThreadExitHandler(dRequestData, (ClientData) requestData);*/
  +
       /* -------------------------------------------------------------------------
        * done
        * ---------------------------------------------------------------------- */
  
  
  
  1.10      +3 -3      tcl-websh/src/generic/request.h
  
  Index: request.h
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/request.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- request.h	24 Jul 2002 22:30:39 -0000	1.9
  +++ request.h	25 Jul 2002 10:10:22 -0000	1.10
  @@ -101,7 +101,7 @@
   RequestData;
   
   
  -void dRequestData(ClientData clientData);
  +/*void dRequestData(ClientData clientData);*/
   
   RequestData *createRequestData(Tcl_Interp * interp);
   int resetRequestData(Tcl_Interp * interp, RequestData * requestData);
  @@ -110,7 +110,7 @@
   int removeTempFiles(Tcl_Interp * interp, RequestData * requestData);
   
   
  -int request_Init(Tcl_Interp * interp, int initial);
  +int request_Init(Tcl_Interp * interp);
   
   int Web_Request(ClientData clientData,
   		Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]);
  
  
  
  1.6       +3 -6      tcl-websh/src/generic/web.c
  
  Index: web.c
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/web.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- web.c	24 Jul 2002 23:13:03 -0000	1.5
  +++ web.c	25 Jul 2002 10:10:22 -0000	1.6
  @@ -26,13 +26,10 @@
   
       UrlData *urlData;
       RequestData *requestData;
  -    int initial;
   
       if (interp == NULL)
   	return TCL_ERROR;
   
  -    initial = (Tcl_GetMaster(interp) == NULL);
  -
       /* --------------------------------------------------------------------------
        * stubs
        * ----------------------------------------------------------------------- */
  @@ -88,7 +85,7 @@
       /* --------------------------------------------------------------------------
        * request data management
        * ----------------------------------------------------------------------- */
  -    if (request_Init(interp, initial) == TCL_ERROR)
  +    if (request_Init(interp) == TCL_ERROR)
   	return TCL_ERROR;
   
       /* --------------------------------------------------------------------------
  @@ -110,7 +107,7 @@
       /* --------------------------------------------------------------------------
        * config
        * ----------------------------------------------------------------------- */
  -    if (cfg_Init(interp, initial) == TCL_ERROR)
  +    if (cfg_Init(interp) == TCL_ERROR)
   	return TCL_ERROR;
   
       /* --------------------------------------------------------------------------
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-cvs-help@tcl.apache.org