richter     01/11/14 01:30:31

  Modified:    .        Tag: Embperl2c ep.h epcomp.c epdom.c epdom.h
                        epmain.c epparse.c epprovider.c eputil.c test.pl
               test/conf Tag: Embperl2c httpd.conf.src
  Log:
  Embperl 2 - memory debugging
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.27.4.30 +1 -1      embperl/ep.h
  
  Index: ep.h
  ===================================================================
  RCS file: /home/cvs/embperl/ep.h,v
  retrieving revision 1.27.4.29
  retrieving revision 1.27.4.30
  diff -u -r1.27.4.29 -r1.27.4.30
  --- ep.h      2001/11/13 20:26:05     1.27.4.29
  +++ ep.h      2001/11/14 09:30:29     1.27.4.30
  @@ -679,7 +679,7 @@
   #define newSVsv(sv) AddDMallocMagic(Perl_newSVsv((sv)), "newSVsv  ", __FILE__, 
__LINE__) 
   
   #undef newSVpvf2
  -#define newSVpvf2(sv) AddDMallocMagic((sv), "newSVsvf  ", __FILE__, __LINE__) 
  +#define newSVpvf2(sv) AddDMallocMagic((sv), "newSVsvf  ", __FILE__, __LINE__) ; 
SvTAINTED_off (sv) 
   
   #undef perl_get_sv
   #define perl_get_sv(name,create) AddDMallocMagic(perl_get_sv(name,create), 
"perl_get_sv  ", __FILE__, __LINE__) 
  
  
  
  1.4.2.77  +20 -12    embperl/Attic/epcomp.c
  
  Index: epcomp.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epcomp.c,v
  retrieving revision 1.4.2.76
  retrieving revision 1.4.2.77
  diff -u -r1.4.2.76 -r1.4.2.77
  --- epcomp.c  2001/11/13 20:26:06     1.4.2.76
  +++ epcomp.c  2001/11/14 09:30:29     1.4.2.77
  @@ -9,7 +9,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epcomp.c,v 1.4.2.76 2001/11/13 20:26:06 richter Exp $
  +#   $Id: epcomp.c,v 1.4.2.77 2001/11/14 09:30:29 richter Exp $
   #
   
###################################################################################*/
   
  @@ -1049,7 +1049,6 @@
   
       {
       int rc ;
  -    char *          pCode = NULL ; 
       char *          sStackValue = NULL ;
       int i ;
   
  @@ -1125,7 +1124,10 @@
            {
            if (embperl_CompileToPerlCode (pDomTree, pNode, pCmd -> sMatchStack, 
&sStackValue))
                if ((rc = embperl_CompileMatchStack (pDomTree, pNode, pCmd -> 
sStackName, sStackValue)) != ok)
  +                 {
  +                 StringFree (&sStackValue) ;
                    return rc ;
  +                 }
            }
        if (pCmd -> sPushStack)
            {
  @@ -1142,7 +1144,6 @@
        }
   
       StringFree (&sStackValue) ;
  -    StringFree (&pCode) ;
   
       return ok ;
       }
  @@ -1274,7 +1275,12 @@
                if (embperl_CompileToPerlCode (pDomTree, pNode, pCmd -> sMatchStack, 
&sStackValue))
                    {
                    if ((rc = embperl_CompileMatchStack (pDomTree, pNode, pCmd -> 
sStackName, sStackValue)) != ok)
  +                     {
  +                     StringFree (&pCode) ;
  +                     StringFree (&pCTCode) ;
  +                     StringFree (&sStackValue) ;
                        return rc ;
  +                     }
                    }
                }
            else if (pCmd -> sPushStack && pCmd -> sPerlCodeEnd)
  @@ -1600,17 +1606,19 @@
       r -> nPhase  = phRunAfterCompile ;
       
       l = ArrayGetSize (r -> pProgDef) ;
  -    if (l && r -> bDebug & dbgCompile)
  +    if (l > 1 && r -> bDebug & dbgCompile)
        lprintf (r, "[%d]EPCOMP: AfterCompileTimeCode:    %*.*s\n", r -> nPid, l, l, r 
-> pProgDef) ; 
   
  -    /* pSV = newSVpvf("package %s ; \nmy ($_ep_req, $_ep_DomTree) = @_;\n%*.*s", r 
-> Buf.sEvalPackage, l,l, r -> pProgDef) ; */
  -    pSV = newSVpvf("package %s ; \n%*.*s", r -> Buf.sEvalPackage, l,l, r -> 
pProgDef) ;
  -    newSVpvf2(pSV) ;
  -    args[0] = r -> pReqSV ;
  -    args[1] = pDomTree -> pDomTreeSV ;
  -    if ((rc = EvalDirect (r, pSV, 0, args)) != ok)
  -     LogError (r, rc) ;
  -    SvREFCNT_dec(pSV);
  +    if (l > 1)
  +     {
  +     pSV = newSVpvf("package %s ; \n%*.*s", r -> Buf.sEvalPackage, l,l, r -> 
pProgDef) ;
  +     newSVpvf2(pSV) ;
  +     args[0] = r -> pReqSV ;
  +     args[1] = pDomTree -> pDomTreeSV ;
  +     if ((rc = EvalDirect (r, pSV, 0, args)) != ok)
  +         LogError (r, rc) ;
  +     SvREFCNT_dec(pSV);
  +     }
   
       cl3 = clock () ;
       
  
  
  
  1.4.2.74  +98 -25    embperl/Attic/epdom.c
  
  Index: epdom.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.c,v
  retrieving revision 1.4.2.73
  retrieving revision 1.4.2.74
  diff -u -r1.4.2.73 -r1.4.2.74
  --- epdom.c   2001/11/13 07:35:17     1.4.2.73
  +++ epdom.c   2001/11/14 09:30:29     1.4.2.74
  @@ -9,7 +9,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epdom.c,v 1.4.2.73 2001/11/13 07:35:17 richter Exp $
  +#   $Id: epdom.c,v 1.4.2.74 2001/11/14 09:30:29 richter Exp $
   #
   
###################################################################################*/
   
  @@ -233,6 +233,27 @@
       }
   
   
  +#ifdef DMALLOC
  +
  +void * str_realloc_dbg (void * s, size_t  n, char * fn, int l)
  +    {
  +    void * m = ((size_t *)s) - 1 ;
  +    size_t * m_size;
  +    nMemUsage -= *((size_t *)m) ;
  +    if (m = _realloc_leap (fn, l, m, n + sizeof (size_t)))
  +     {
  +     nMemUsage += n ;
  +     /* make the following in multiple step, so sun-cc is happy... */
  +     m_size = (size_t *) m;
  +     *m_size = n;
  +     m_size++;
  +     m = (void *) m_size ;
  +     }
  +    return m ;
  +    }
  +
  +#endif
  +
   void str_free (void * s)
       {
       void * m = ((size_t *)s) - 1 ;
  @@ -308,7 +329,8 @@
       pNew -> nFill = 0  ;
       pNew -> nElementSize = nElementSize  ;
   #ifdef DMALLOC
  -    strncpy (pNew -> sFile, sFile, sizeof (pNew -> sFile)) ;
  +    strncpy (pNew -> sSig, "ARY  ", sizeof (pNew -> sSig)) ;
  +    pNew -> sFile = sFile ;
       pNew -> nLine = nLine ;
   #endif
       return ok ;
  @@ -370,7 +392,8 @@
       pNew -> nFill = 0  ;
       pNew -> nElementSize = nElementSize  ;
   #ifdef DMALLOC
  -    strncpy (pNew -> sFile, sFile, sizeof (pNew -> sFile)) ;
  +    strncpy (pNew -> sSig, "ARY  ", sizeof (pNew -> sSig)) ;
  +    pNew -> sFile = sFile ;
       pNew -> nLine = nLine ;
   #endif
   
  @@ -412,9 +435,15 @@
   /*                                                                          */
   /* ------------------------------------------------------------------------ */
   
  +#ifdef DMALLOC
  +int ArrayClone_dbg (/*in*/  const tArray * pOrgArray,
  +             /*out*/ const tArray * pNewArray,             
  +             /*in*/ char *     sFile,
  +             /*in*/ int        nLine) 
  +#else
   int ArrayClone (/*in*/  const tArray * pOrgArray,
                /*out*/ const tArray * pNewArray)
  -
  +#endif
   
       {
       if (pOrgArray)
  @@ -423,8 +452,13 @@
           struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(*(void * *)pOrgArray)) - 
1 ;
           int    size = pCtrl -> nFill * pCtrl -> nElementSize + sizeof (struct 
tArrayCtrl) ;
       
  +#ifdef DMALLOC
  +     if ((pNew = str_malloc_dbg (size, sFile, nLine)) == NULL)
  +         return 0 ;
  +#else
           if ((pNew = str_malloc (size)) == NULL)
            return 0 ;
  +#endif
       
           memcpy (pNew, pCtrl, size) ; 
           *(void * *)pNewArray = (struct tArray *)(pNew + 1) ;
  @@ -460,9 +494,13 @@
        struct tArrayCtrl * pNew ;
        int                 nNewMax = pCtrl -> nFill + numElements + pCtrl -> nAdd ;
        
  +#ifdef DMALLOC
  +     if ((pNew = str_realloc_dbg (pCtrl, nNewMax * pCtrl -> nElementSize + sizeof 
(struct tArrayCtrl), pCtrl -> sFile, pCtrl -> nLine)) == NULL)
  +         return 0 ;
  +#else        
        if ((pNew = str_realloc (pCtrl, nNewMax * pCtrl -> nElementSize + sizeof 
(struct tArrayCtrl))) == NULL)
            return 0 ;
  -     
  +#endif       
        *(void * *)pArray = (struct tArray *)(pNew + 1) ;
        pNew -> nMax = nNewMax ;
        pCtrl = pNew ;
  @@ -524,8 +562,13 @@
        if (nNewMax < numElements)
            nNewMax = numElements + pCtrl -> nAdd ;
        
  +#ifdef DMALLOC
  +     if ((pNew = str_realloc_dbg (pCtrl, nNewMax * pCtrl -> nElementSize + sizeof 
(struct tArrayCtrl), pCtrl -> sFile, pCtrl -> nLine)) == NULL)
  +         return 0 ;
  +#else        
        if ((pNew = str_realloc (pCtrl, nNewMax * pCtrl -> nElementSize + sizeof 
(struct tArrayCtrl))) == NULL)
            return 0 ;
  +#endif
        
        p = (char *)(pNew + 1) ;
        *(void * *)pArray = (struct tArray *)p ;
  @@ -591,12 +634,23 @@
   /* ------------------------------------------------------------------------ */
   
   
  +#ifdef DMALLOC
  +void StringNew_dbg (/*in*/ char * * pArray,
  +           /*in*/ int        nAdd,
  +           /*in*/ char *     sFile,
  +           /*in*/ int        nLine) 
  +#else
   void StringNew (/*in*/ char * * pArray,
              /*in*/ int        nAdd)
  +#endif
   
       {              
       if ((*(void * *)pArray) == NULL)
  +#ifdef DMALLOC
  +     ArrayNew_dbg (pArray, nAdd, sizeof (char), sFile, nLine) ;
  +#else
        ArrayNew (pArray, nAdd, sizeof (char)) ;
  +#endif
       else
        ArraySetSize (pArray, 0);
       }
  @@ -883,6 +937,9 @@
   
       {
       lprintf (pCurrReq, "[%d]PERF: DOMSTAT: MemUsage = %d Bytes  numNodes = %d  
numLevelLookup = %d  numLevelLookupItem = %d  numStr = %d  numReplace = %d  \n", 
pCurrReq -> nPid, nMemUsage, numNodes, numLevelLookup, numLevelLookupItem, numStr, 
numReplace) ;
  +#ifdef DMALLOC
  +        dmalloc_message ("[%d]PERF: DOMSTAT: MemUsage = %d Bytes  numNodes = %d  
numLevelLookup = %d  numLevelLookupItem = %d  numStr = %d  numReplace = %d  \n", 
pCurrReq -> nPid, nMemUsage, numNodes, numLevelLookup, numLevelLookupItem, numStr, 
numReplace) ;
  +#endif        
       }
   
   /* ------------------------------------------------------------------------ */
  @@ -975,6 +1032,7 @@
       int        numLookup  ;
       tIndex     xDomTree  = pDomTree -> xNdx ;
       tIndex     xNdx ;
  +    tIndex     xNode ;
       tRepeatLevelLookup * pLookupLevelNode  ;
       tRepeatLevelLookupItem * pLookupLevelNodeLevel  ;
       tRepeatLevelLookupItem * pItem  ;
  @@ -1024,29 +1082,32 @@
            if (pNode -> nText)
                NdxStringFree (pNode -> nText) ;
            
  -     
  -         if ((pLookupLevelNode = pLookup ->  pLookupLevel) && pLookupLevelNode -> 
xNullNode == pNode -> xNdx)
  +         xNode = pNode -> xNdx ;
  +         dom_free (pNode, &numNodes) ;
  +         }
  +     else
  +         pNode = NULL ;
  +
  +     if ((pLookupLevelNode = pLookup ->  pLookupLevel) && (pLookupLevelNode -> 
xNullNode == xNode || pNode == NULL))
  +         {
  +         pLookupLevelNodeLevel = pLookupLevelNode -> items ;
  +         n = pLookupLevelNode -> numItems ;
  +         while (n-- > 0)
                {
  -             pLookupLevelNodeLevel = pLookupLevelNode -> items ;
  -             n = pLookupLevelNode -> numItems ;
  -             while (n-- > 0)
  +             pNext = pLookupLevelNodeLevel -> pNext ;
  +             while (pNext)
                    {
  -                 pNext = pLookupLevelNodeLevel -> pNext ;
  -                 while (pNext)
  -                     {
  -                     pItem = pNext ;
  -                     pNext = pItem -> pNext ;
  -                     dom_free_size (pItem, sizeof (tRepeatLevelLookupItem), 
&numLevelLookupItem) ;
  -                     }
  -                 pLookupLevelNodeLevel++ ;
  +                 pItem = pNext ;
  +                 pNext = pItem -> pNext ;
  +                 dom_free_size (pItem, sizeof (tRepeatLevelLookupItem), 
&numLevelLookupItem) ;
                    }
  -
  -             
  -             dom_free_size (pLookupLevelNode, sizeof (tRepeatLevelLookup)  + sizeof 
(tRepeatLevelLookupItem) * pLookupLevelNode -> numItems, &numLevelLookup) ;
  +             pLookupLevelNodeLevel++ ;
                }
   
  -         dom_free (pNode, &numNodes) ;
  -            }
  +         
  +         dom_free_size (pLookupLevelNode, sizeof (tRepeatLevelLookup)  + sizeof 
(tRepeatLevelLookupItem) * (pLookupLevelNode -> numItems - 1), &numLevelLookup) ;
  +         }
  +
   
        pLookup-- ;
        }
  @@ -1128,6 +1189,8 @@
       
       pDomTree -> xDocument = pOrgDomTree -> xDocument ;
       pDomTree -> xSourceNdx= pOrgDomTree -> xNdx ;
  +    if (pCurrReq -> bDebug & dbgDOM)
  +     lprintf (pCurrReq, "[%d]DOM: DomTree %d depends on DomTree %d\n", pCurrReq -> 
nPid, pDomTree -> xNdx, pOrgDomTree -> xNdx) ; 
       av_push (pDomTree -> pDependsOn, SvREFCNT_inc (pOrgDomTree -> pDomTreeSV)) ;
       pDomTree -> xFilename = pOrgDomTree -> xFilename ;
   
  @@ -2430,11 +2493,13 @@
                    pLookupLevelNodeLevel -> pNode = NULL ;
                    }
                }
  +         if (pLookupLevelNode -> xNullNode != pChild -> xNdx)
  +             pDomTree -> pLookup[pChild -> xNdx].pLookupLevel = NULL ;
            }    
  +     
        }
   
       dom_free (pChild, &numNodes) ;
  -    numNodes-- ;
   
       return NULL ;
       }
  @@ -2566,8 +2631,12 @@
        }
   
       if (pOldChildDomTree -> xNdx != pDomTree -> xNdx)
  +     {
  +     if (pCurrReq -> bDebug & dbgDOM)
  +         lprintf (pCurrReq, "[%d]DOM: DomTree %d depends on DomTree %d\n", pCurrReq 
-> nPid, pOldChildDomTree -> xNdx, pDomTree -> xNdx) ; 
           av_push (pOldChildDomTree -> pDependsOn, SvREFCNT_inc (pDomTree -> 
pDomTreeSV)) ;
  -     
  +     }
  +    
       return xOldChild ;
       }
   
  @@ -2645,7 +2714,11 @@
        }
   
       if (pRefNodeDomTree -> xNdx != pNewNodeDomTree -> xNdx)
  +     {
  +     if (pCurrReq -> bDebug & dbgDOM)
  +         lprintf (pCurrReq, "[%d]DOM: DomTree %d depends on DomTree %d\n", pCurrReq 
-> nPid, pRefNodeDomTree -> xNdx, pNewNodeDomTree -> xNdx) ; 
           av_push (pRefNodeDomTree -> pDependsOn, SvREFCNT_inc (pNewNodeDomTree -> 
pDomTreeSV)) ;
  +     }
   
       return pNewNode -> xNdx ;
       }
  
  
  
  1.4.2.44  +27 -3     embperl/Attic/epdom.h
  
  Index: epdom.h
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epdom.h,v
  retrieving revision 1.4.2.43
  retrieving revision 1.4.2.44
  diff -u -r1.4.2.43 -r1.4.2.44
  --- epdom.h   2001/11/12 12:45:40     1.4.2.43
  +++ epdom.h   2001/11/14 09:30:30     1.4.2.44
  @@ -9,7 +9,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epdom.h,v 1.4.2.43 2001/11/12 12:45:40 richter Exp $
  +#   $Id: epdom.h,v 1.4.2.44 2001/11/14 09:30:30 richter Exp $
   #
   
###################################################################################*/
   
  @@ -18,8 +18,9 @@
   struct tArrayCtrl
       {
   #ifdef DMALLOC
  -    int          nLine ;
  -    char    sFile [128] ;
  +    char    sSig [6] ;
  +    char *  sFile ;
  +    int     nLine ;
   #endif
       int          nFill ;         /* index of last element */
       int          nMax ;          /* number of last element for which is space */
  @@ -277,9 +278,17 @@
              /*in*/ int        nElementSize,
              /*in*/ char *     sFile,
              /*in*/ int        nLine) ;
  +int ArrayClone_dbg (/*in*/  const tArray * pOrgArray,
  +             /*out*/ const tArray * pNewArray,             
  +             /*in*/ char *     sFile,
  +             /*in*/ int        nLine) ;
   
  +#undef ArrayNew
   #define ArrayNew(a,n,s) ArrayNew_dbg(a,n,s,__FILE__,__LINE__)
  +#undef ArrayNewZero
   #define ArrayNewZero(a,n,s) ArrayNewZero_dbg(a,n,s,__FILE__,__LINE__)
  +#undef ArrayClone
  +#define ArrayClone(o,n) ArrayClone_dbg(o,n,__FILE__,__LINE__)
   
   #else
   
  @@ -290,6 +299,10 @@
   int ArrayNewZero (/*in*/ const tArray * pArray,
              /*in*/ int        nAdd,
              /*in*/ int        nElementSize) ;
  +
  +int ArrayClone (/*in*/  const tArray * pOrgArray,
  +             /*out*/ const tArray * pNewArray) ;
  +
   #endif
   
   int ArrayFree (/*in*/ const tArray * pArray) ;
  @@ -308,8 +321,19 @@
   int ArraySub (/*in*/ const tArray * pArray,
              /*in*/ int        numElements) ;
   
  +#ifdef DMALLOC
  +void StringNew_dbg (/*in*/ char * * pArray,
  +           /*in*/ int        nAdd,
  +           /*in*/ char *     sFile,
  +           /*in*/ int        nLine) ;
  +
  +#undef StringNew
  +#define StringNew(a,n) StringNew_dbg(a,n,__FILE__,__LINE__)
  +
  +#else
   void StringNew (/*in*/ char * * pArray,
              /*in*/ int        nAdd) ;
  +#endif
   
   void StringFree (/*in*/ char * * pArray) ;
   
  
  
  
  1.75.4.66 +12 -1     embperl/epmain.c
  
  Index: epmain.c
  ===================================================================
  RCS file: /home/cvs/embperl/epmain.c,v
  retrieving revision 1.75.4.65
  retrieving revision 1.75.4.66
  diff -u -r1.75.4.65 -r1.75.4.66
  --- epmain.c  2001/11/13 20:26:06     1.75.4.65
  +++ epmain.c  2001/11/14 09:30:30     1.75.4.66
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epmain.c,v 1.75.4.65 2001/11/13 20:26:06 richter Exp $
  +#   $Id: epmain.c,v 1.75.4.66 2001/11/14 09:30:30 richter Exp $
   #
   
###################################################################################*/
   
  @@ -1903,6 +1903,9 @@
        free (pConf -> sReqFilename) ;
   
   #ifdef EP2
  +    if (pConf -> sRecipe)
  +     free (pConf -> sRecipe) ;
  + 
       if (pConf -> sCacheKey)
        free (pConf -> sCacheKey) ;
    
  @@ -2643,7 +2646,11 @@
   #ifdef DMALLOC
                            /* unsigned long mark, int not_freed_b, int freed_b, int 
details_b */
       dmalloc_log_changed (r -> MemCheckpoint, 1, 0, 1) ;
  +    dmalloc_message ( "[%d]%sRequest freed. Entry-SVs: %d -OBJs: %d Exit-SVs: %d 
-OBJs: %d\n", r -> nPid,
  +         (r -> bSubReq?"Sub-":""), r -> stsv_count, r -> stsv_objcount, sv_count, 
sv_objcount) ;
   #endif    
  +    if (r -> bDebug)
  +     DomStats () ;
   
       r -> pNext = pReqFree ;
       pReqFree = r ;
  @@ -3307,6 +3314,10 @@
           lprintf (r, "\n") ;    
           lprintf (r, "[%d]%sRequest finished. %s. Entry-SVs: %d -OBJs: %d Exit-SVs: 
%d -OBJs: %d\n", r -> nPid,
            (r -> bSubReq?"Sub-":""), asctime(tm), r -> stsv_count, r -> 
stsv_objcount, sv_count, sv_objcount) ;
  +#ifdef DMALLOC
  +        dmalloc_message ( "[%d]%sRequest finished. Entry-SVs: %d -OBJs: %d 
Exit-SVs: %d -OBJs: %d\n", r -> nPid,
  +         (r -> bSubReq?"Sub-":""), r -> stsv_count, r -> stsv_objcount, sv_count, 
sv_objcount) ;
  +#endif        
           }
   
       
  
  
  
  1.4.2.43  +66 -17    embperl/Attic/epparse.c
  
  Index: epparse.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epparse.c,v
  retrieving revision 1.4.2.42
  retrieving revision 1.4.2.43
  diff -u -r1.4.2.42 -r1.4.2.43
  --- epparse.c 2001/11/13 07:35:17     1.4.2.42
  +++ epparse.c 2001/11/14 09:30:30     1.4.2.43
  @@ -9,7 +9,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epparse.c,v 1.4.2.42 2001/11/13 07:35:17 richter Exp $
  +#   $Id: epparse.c,v 1.4.2.43 2001/11/14 09:30:30 richter Exp $
   #
   
###################################################################################*/
   
  @@ -988,30 +988,32 @@
   /*                                                                          */
   /*! 
   *   \_en
  -*   Parse source and create DomTree
  +*   Parse source into given DomTree
   *   
   *   @param  r               Embperl request record
   *   @param  pSource         Sourcetext
   *   @param  nLen            Length of Sourcetext
  +*   @param  pDomTree     Destination DomTree
   *   @return                 error code
   *   \endif                                                                       
   *
   *   \_de                                                                        
  -*   Parst die Quelle und erzeugt einen DomTree
  +*   Parst die Quelle in den gegebenen  DomTree
   *   
   *   @param  r               Embperl request record
   *   @param  pSource         Quellentext
   *   @param  nLen            L�nge des Quellentext
  +*   @param  pDomTree     Ziel DomTree
   *   @return                 Fehlercode
   *   \endif                                                                       
   *                                                                          
   * ------------------------------------------------------------------------ */
   
   
  -int embperl_Parse (/*i/o*/ register req * r,
  +static int embperl_ParseSource (/*i/o*/ register req * r,
                      /*in*/  char *   pSource,
                      /*in*/  size_t         nLen,
  -                   /*out*/ tIndex *       pxDomTree)
  +                /*in*/  tDomTree * pDomTree)
   
       {
       char * pStart = pSource ;
  @@ -1019,7 +1021,6 @@
       int          rc ;
       tNode   xDocNode ;
       tNode   xNode ;
  -    tDomTree * pDomTree = DomTree_self (r -> xCurrDomTree) ;
       tTokenTable * pTokenTableSave ;
       clock_t  cl1 = clock () ;
       clock_t  cl2 ;
  @@ -1028,31 +1029,27 @@
       r -> Buf.pEndPos = (char *)pEnd ;
       r -> Buf.pSourcelinePos = r -> Buf.pCurrPos = r -> Buf.pBuf ;
   
  -    
  -    if (!(r -> xCurrDomTree  = DomTree_new (&pDomTree)))
  -     return 1 ;
  -
       if (r -> bDebug & dbgParse)
        lprintf (r, "[%d]PARSE: Start parsing %s DomTree = %d\n", r -> nPid, r -> 
Buf.pFile -> sSourcefile, r -> xCurrDomTree) ; 
       
       pDomTree -> xFilename = String2Ndx (r -> Buf.pFile -> sSourcefile, strlen (r -> 
Buf.pFile -> sSourcefile)) ;
       
       if (!(xDocNode = Node_appendChild (pDomTree, 0, 0, ntypTag, 0, "attr", 3, 0, 0, 
NULL)))
  -     return 1 ;
  +     return rcOutOfMemory ;
   
       if (!(xDocNode = Node_appendChild (pDomTree,  0, 0, r -> 
bSubReq?ntypDocumentFraq:ntypDocument, 0, 
                                        NULL, r -> bSubReq?xDocumentFraq:xDocument, 0, 
0, NULL)))
  -     return 1 ;
  +     return rcOutOfMemory ;
       
       if (!(xNode = Node_appendChild (pDomTree, xDocNode, 0, ntypAttr, 0, NULL, 
xDomTreeAttr, 0, 0, NULL)))
  -     return 1 ;
  +     return rcOutOfMemory ;
   
       if (!(xNode = Node_appendChild (pDomTree, xNode, 0, ntypAttrValue, 0, NULL, r 
-> xCurrDomTree, 0, 0, NULL)))
  -     return 1 ;
  +     return rcOutOfMemory ;
   
       /* Add at least one child node to document to make insertafter at the beginning 
of the document work */
       if (!(xNode = Node_appendChild (pDomTree, xDocNode, 0, ntypCDATA, 0, "", 0, 0, 
0, NULL)))
  -     return 1 ;
  +     return rcOutOfMemory ;
   
       pDomTree -> xDocument = xDocNode ;
   
  @@ -1063,11 +1060,10 @@
       
       /* Add one child node end the end to catch loops that end at the very last node 
*/
       if (!(xNode = Node_appendChild (pDomTree, xDocNode, 0, ntypCDATA, 0, "", 0, 0, 
0, NULL)))
  -     return 1 ;
  +     return rcOutOfMemory ;
   
       r -> pTokenTable = pTokenTableSave ;
   
  -    *pxDomTree = r -> xCurrDomTree ;
   
   #ifdef CLOCKS_PER_SEC
       if (r -> bDebug)
  @@ -1080,6 +1076,59 @@
        }
   #endif        
   
  +    return ok ;
  +    }
  +
  +
  +/* ------------------------------------------------------------------------ */
  +/*                                                                          */
  +/* embperl_Parse                                                            */
  +/*                                                                          */
  +/*! 
  +*   \_en
  +*   Parse source and create DomTree
  +*   
  +*   @param  r               Embperl request record
  +*   @param  pSource         Sourcetext
  +*   @param  nLen            Length of Sourcetext
  +*   @param  pxDomTree            Returns DomTree index
  +*   @return                 error code
  +*   \endif                                                                       
  +*
  +*   \_de                                                                        
  +*   Parst die Quelle und erzeugt einen DomTree
  +*   
  +*   @param  r               Embperl request record
  +*   @param  pSource         Quellentext
  +*   @param  nLen            L�nge des Quellentext
  +*   @param  pxDomTree            Gibt DomTree Index zur�ck
  +*   @return                 Fehlercode
  +*   \endif                                                                       
  +*                                                                          
  +* ------------------------------------------------------------------------ */
  +
  +
  +int embperl_Parse (/*i/o*/ register req * r,
  +                   /*in*/  char *      pSource,
  +                   /*in*/  size_t         nLen,
  +                   /*out*/ tIndex *       pxDomTree)
  +
  +    {
  +    int          rc ;
  +    tDomTree * pDomTree  ;
  +    
  +    if (!(r -> xCurrDomTree  = DomTree_new (&pDomTree)))
  +     return rcOutOfMemory ;
  +
  +    if ((rc = embperl_ParseSource (r, pSource, nLen, pDomTree)) != ok)
  +     {
  +     pDomTree = DomTree_self (r -> xCurrDomTree) ;
  +     *pxDomTree = r -> xCurrDomTree  = 0 ;
  +     DomTree_delete (pDomTree) ;
  +     return rc ;
  +     }
  +
  +    *pxDomTree = r -> xCurrDomTree  ;
       return ok ;
       }
   
  
  
  
  1.1.2.10  +11 -4     embperl/Attic/epprovider.c
  
  Index: epprovider.c
  ===================================================================
  RCS file: /home/cvs/embperl/Attic/epprovider.c,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- epprovider.c      2001/11/12 12:45:40     1.1.2.9
  +++ epprovider.c      2001/11/14 09:30:30     1.1.2.10
  @@ -9,7 +9,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: epprovider.c,v 1.1.2.9 2001/11/12 12:45:40 richter Exp $
  +#   $Id: epprovider.c,v 1.1.2.10 2001/11/14 09:30:30 richter Exp $
   #
   
###################################################################################*/
   
  @@ -1018,15 +1018,22 @@
       STRLEN  len ;
       tIndex  xSrcDomTree ;
       tCacheItem * pSrcCache ;
  +    SV *         pProg = NULL ;
   
       pSrcCache = Cache_GetDependency(r, pProvider -> pCache, 0) ;
       if ((rc = Cache_GetContentIndex (r, pSrcCache, &xSrcDomTree)) != ok)
           return rc ;
           
  -    if ((rc =  embperl_Compile (r, xSrcDomTree, pData, &((tProviderEpCompile 
*)pProvider) -> pSVData)) != ok)
  -        return rc ;
  +    if ((rc =  embperl_Compile (r, xSrcDomTree, pData, &pProg )) != ok)
  +        {
  +     ((tProviderEpCompile *)pProvider) -> pSVData = NULL ;
  +     if (pProg)
  +         SvREFCNT_dec (pProg) ;
   
  -    
  +     return rc ;
  +     }
  +
  +    ((tProviderEpCompile *)pProvider) -> pSVData = pProg ;
   
       return ok ;
       }
  
  
  
  1.15.4.27 +9 -6      embperl/eputil.c
  
  Index: eputil.c
  ===================================================================
  RCS file: /home/cvs/embperl/eputil.c,v
  retrieving revision 1.15.4.26
  retrieving revision 1.15.4.27
  diff -u -r1.15.4.26 -r1.15.4.27
  --- eputil.c  2001/11/13 20:26:06     1.15.4.26
  +++ eputil.c  2001/11/14 09:30:30     1.15.4.27
  @@ -10,7 +10,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: eputil.c,v 1.15.4.26 2001/11/13 20:26:06 richter Exp $
  +#   $Id: eputil.c,v 1.15.4.27 2001/11/14 09:30:30 richter Exp $
   #
   
###################################################################################*/
   
  @@ -1496,18 +1496,21 @@
                      /*in*/ int        nLine) 
   
       {
  -    if (pSV)
  +    if (pSV && (!SvMAGICAL(pSV) || !mg_find (pSV, '~')))
        {
        char * s = _strdup_leap(sFile, nLine, sText) ;
        struct magic * pMagic ;
       
  -     /* we use magic type 'x', hopefully this doesn't get any collisions ... */
  -     sv_unmagic ((SV *)pSV, 'x') ;
  -     sv_magic ((SV *)pSV, NULL, 'x', (char *)&s, sizeof (s)) ;
  -     pMagic = mg_find (pSV, 'x') ;
  +     if ((!SvMAGICAL(pSV) || !(pMagic = mg_find (pSV, '~'))))
  +         {
  +         sv_magic ((SV *)pSV, NULL, '~', (char *)&s, sizeof (s)) ;
  +         pMagic = mg_find (pSV, '~') ;
  +         }
   
        if (pMagic)
  +         {
            pMagic -> mg_virtual = &DMalloc_mvtTab ;
  +         }
        else
            {
            LogError (pCurrReq, rcMagicError) ;
  
  
  
  1.70.4.92 +6 -2      embperl/test.pl
  
  Index: test.pl
  ===================================================================
  RCS file: /home/cvs/embperl/test.pl,v
  retrieving revision 1.70.4.91
  retrieving revision 1.70.4.92
  diff -u -r1.70.4.91 -r1.70.4.92
  --- test.pl   2001/11/12 07:32:22     1.70.4.91
  +++ test.pl   2001/11/14 09:30:30     1.70.4.92
  @@ -11,7 +11,7 @@
   #   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
   #   WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   #
  -#   $Id: test.pl,v 1.70.4.91 2001/11/12 07:32:22 richter Exp $
  +#   $Id: test.pl,v 1.70.4.92 2001/11/14 09:30:30 richter Exp $
   #
   ###################################################################################
   
  @@ -58,11 +58,13 @@
           'repeat'     => 3,
           'errors'     => 8,
           'version'    => 1,
  +        'noloop'     => 1, # Perl leaks on eval syntax error
           },
       'error.htm' => { 
           'repeat'     => 3,
           'errors'     => 6,
           'version'    => 2,
  +        'noloop'     => 1, # Perl leaks on eval syntax error
           },
       'errormismatch.htm' => { 
           'errors'     => '1',
  @@ -101,6 +103,7 @@
           'errors'     => 6,
           'version'    => 2,
           'cgi'        => 0,
  +        'noloop'     => 1, # Perl leaks on eval syntax error
           },
       'errdoc/epl/errdoc2.htm' => { 
           'option'     => '262144',
  @@ -114,7 +117,7 @@
           'errors'     => 6,
           'version'    => 2,
           'cgi'        => 0,
  -        'noloop'     => 1,
  +        'noloop'     => 1, # Perl leaks on eval syntax error
           },
       'rawinput/rawinput.htm' => { 
           'option'     => '16',
  @@ -152,6 +155,7 @@
           'condition'  => '$] >= 5.006000', 
           'cmpext'     => '56',
           'version'    => 2,
  +        'noloop'     => 1, # Perl leaks on eval syntax error
           },
       'varerr.htm' => { 
           'errors'     => 2,
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.24.4.24 +3 -0      embperl/test/conf/httpd.conf.src
  
  Index: httpd.conf.src
  ===================================================================
  RCS file: /home/cvs/embperl/test/conf/httpd.conf.src,v
  retrieving revision 1.24.4.23
  retrieving revision 1.24.4.24
  diff -u -r1.24.4.23 -r1.24.4.24
  --- httpd.conf.src    2001/10/31 13:26:43     1.24.4.23
  +++ httpd.conf.src    2001/11/14 09:30:31     1.24.4.24
  @@ -57,6 +57,9 @@
   
   PerlSetEnv EMBPERL_SRC \"$EPPATH\"
   SetEnv EMBPERL_SRC \"$EPPATH\"
  +
  +PerlSetEnv DMALLOC_OPTIONS \"log=$EPPATH/test/tmp/httpd.dmalloc.log,debug=0x3f03\" 
  +SetEnv DMALLOC_OPTIONS \"log=$EPPATH/test/tmp/httpd.dmalloc.log,debug=0x3f03\" 
   
   EOD
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to