
richter at apache
Aug 14, 2004, 7:28 AM
Post #1 of 1
(842 views)
Permalink
|
|
cvs commit: embperl/test/html/registry hello.htm
|
|
richter 2004/08/14 07:28:47 Modified: . DOM.xs Embperl.pm MANIFEST Makefile.PL Old.xs ep.h epcache.c epcmd2.c epcomp.c epdom.c epeval.c epinit.c epmain.c epmem.c epprovider.c eputil.c mod_embperl.c test.pl Added: test/cmp hello.htm test/html/registry hello.htm Log: memory debugging and internal structure validaten and fix for apha 64 Revision Changes Path 1.10 +3 -1 embperl/DOM.xs Index: DOM.xs =================================================================== RCS file: /home/cvs/embperl/DOM.xs,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- DOM.xs 23 Jan 2004 06:50:54 -0000 1.9 +++ DOM.xs 14 Aug 2004 14:28:40 -0000 1.10 @@ -299,6 +299,7 @@ pDomTree = DomTree_self (pDomNode -> xDomTree) ; Element_selfSetAttribut (r -> pApp, pDomTree, Node_self (pDomTree, pDomNode -> xNode), r -> Component.nCurrRepeatLevel, sA, nAttr, sT, nText) ; + SvREFCNT_dec (sEscapedText) ; void @@ -321,6 +322,7 @@ pDomTree = DomTree_self (xDomTree) ; Element_selfSetAttribut (r -> pApp, pDomTree, Node_self (pDomTree, xNode), r -> Component.nCurrRepeatLevel, sA, nAttr, sT, nText) ; + SvREFCNT_dec (sEscapedText) ; 1.189 +2 -2 embperl/Embperl.pm Index: Embperl.pm =================================================================== RCS file: /home/cvs/embperl/Embperl.pm,v retrieving revision 1.188 retrieving revision 1.189 diff -u -r1.188 -r1.189 --- Embperl.pm 2 Apr 2004 05:10:41 -0000 1.188 +++ Embperl.pm 14 Aug 2004 14:28:40 -0000 1.189 @@ -47,7 +47,7 @@ @ISA = qw(Exporter DynaLoader); -$VERSION = '2.0b11' ; +$VERSION = '2.0' ; if ($modperl = $ENV{MOD_PERL}) 1.94 +4 -1 embperl/MANIFEST Index: MANIFEST =================================================================== RCS file: /home/cvs/embperl/MANIFEST,v retrieving revision 1.93 retrieving revision 1.94 diff -u -r1.93 -r1.94 --- MANIFEST 20 Jul 2004 08:25:21 -0000 1.93 +++ MANIFEST 14 Aug 2004 14:28:40 -0000 1.94 @@ -325,6 +325,7 @@ test/cmp/pure.htm test/cmp/rawinput.htm test/cmp/recursexec.htm +test/cmp/hello.htm test/cmp/reggetsess.htm test/cmp/reqrec.htm test/cmp/rtfadv.asc @@ -514,7 +515,8 @@ test/html/rawinput/rawinput.htm test/html/recursexec.htm test/html/registry/Execute.htm -test/html/registry/errpage.htm +test/html/registry/errpage.htm +test/html/registry/hello.htm test/html/registry/reggetsess.htm test/html/registry/script.pl test/html/registry/tied.htm @@ -606,3 +608,4 @@ xsbuilder/source_scan.pl xsbuilder/xs_check.pl xsbuilder/xs_generate.pl +META.yml Module meta-data (added by MakeMaker) 1.70 +6 -4 embperl/Makefile.PL Index: Makefile.PL =================================================================== RCS file: /home/cvs/embperl/Makefile.PL,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- Makefile.PL 8 Jul 2004 08:31:00 -0000 1.69 +++ Makefile.PL 14 Aug 2004 14:28:40 -0000 1.70 @@ -240,10 +240,12 @@ if ($mp2cfg) { # with Apache 2, make sure we have the same defines as mod_perl + $txt =~ s/-O\d//g if ($ccdebug =~ /-O\d/) ; $txt =~ s/CCFLAGS\s*=.*?\n/CCFLAGS = $ccdebug $mp2cfg->{MODPERL_CCOPTS}\n/s ; } else { + $txt =~ s/-O\d//g if ($ccdebug =~ /-O\d/) ; $txt =~ s/CCFLAGS\s*=/CCFLAGS = $ccdebug / ; } @@ -498,15 +500,15 @@ if ($ARGV[0] eq 'debug') { shift @ARGV; - $optdebug = '-g -O0' ; + $optdebug = '-g -O0 -Wall -DEPDEBUG' ; if ($win32) { - $ccdebug = '-Zi -W3' ; + $ccdebug = '-Zi -W3 -DEPDEBUG' ; $lddebug = '-debug -map -profile' ; } else { - $ccdebug = '-ggdb -O0' ; + $ccdebug = '-ggdb -O0 -Wall -DEPDEBUG' ; $lddebug = '-g' ; } } 1.9 +1 -1 embperl/Old.xs Index: Old.xs =================================================================== RCS file: /home/cvs/embperl/Old.xs,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Old.xs 9 Aug 2004 19:44:44 -0000 1.8 +++ Old.xs 14 Aug 2004 14:28:40 -0000 1.9 @@ -279,7 +279,7 @@ STRLEN len ; CODE: str = SvPV(ST(1),len) ; - RETVAL = Escape(r, str, len, mode, NULL, 0) ; + RETVAL = Escape(r, str, len, mode, NULL, 0) ; OUTPUT: RETVAL 1.44 +5 -1 embperl/ep.h Index: ep.h =================================================================== RCS file: /home/cvs/embperl/ep.h,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- ep.h 9 Aug 2004 19:44:44 -0000 1.43 +++ ep.h 14 Aug 2004 14:28:40 -0000 1.44 @@ -716,7 +716,6 @@ /*in*/ char * sFile, /*in*/ int nLine) ; - #undef newSV #define newSV(len) AddDMallocMagic(Perl_newSV(aTHX_ (len)), "newSV ", __FILE__, __LINE__) @@ -724,6 +723,7 @@ #define newSViv(i) AddDMallocMagic(Perl_newSViv(aTHX_ (i)), "newSViv ", __FILE__, __LINE__) #define newSVivDBG1(i,txt) AddDMallocMagic(Perl_newSViv(aTHX_ (i)), txt, __FILE__, __LINE__) + #undef newSVnv #define newSVnv(n) AddDMallocMagic(Perl_newSVnv(aTHX_ (n)), "newSVnv ", __FILE__, __LINE__) @@ -738,10 +738,13 @@ #undef newSVsv #define newSVsv(sv) AddDMallocMagic(Perl_newSVsv(aTHX_ (sv)), "newSVsv ", __FILE__, __LINE__) + #undef newSVpvf2 #define newSVpvf2(sv) AddDMallocMagic((sv), "newSVsvf ", __FILE__, __LINE__) ; SvTAINTED_off (sv) + + #undef perl_get_sv #undef perl_get_cv #undef perl_get_hv @@ -758,6 +761,7 @@ #undef newAV #define newAV() (AV *)AddDMallocMagic((SV *)Perl_newAV(aTHX), "newAV ", __FILE__, __LINE__) + #else 1.6 +18 -14 embperl/epcache.c Index: epcache.c =================================================================== RCS file: /home/cvs/embperl/epcache.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- epcache.c 23 Jan 2004 06:50:54 -0000 1.5 +++ epcache.c 14 Aug 2004 14:28:40 -0000 1.6 @@ -19,11 +19,12 @@ /* --- don't use Perl's memory management here --- */ +#ifndef DMALLOC #undef malloc #undef realloc #undef strdup #undef free - +#endif HV * pProviders ; /**< global hash that holds all known providers classes */ HV * pCacheItems ; /**< hash which contains all CacheItems by Key */ @@ -690,6 +691,17 @@ if (nLastUpdated < pItem -> nLastUpdated) return TRUE ; + if (pItem -> pProvider -> pProviderClass -> fExpires) + { + if ((*pItem -> pProvider -> pProviderClass -> fExpires)(r, pItem -> pProvider)) + { + if (r -> Component.Config.bDebug & dbgCache) + lprintf (r -> pApp, "[%d]CACHE: %s expired because provider C sub returned TRUE\n", r -> pThread -> nPid, pItem -> sKey) ; + Cache_FreeContent (r, pItem) ; + return pItem -> bExpired = TRUE ; + } + } + if (pItem -> bExpired || pItem -> nLastChecked == r -> nRequestCount) return pItem -> bExpired ; /* we already have checked this or know that is it expired */ @@ -708,17 +720,6 @@ } } - if (pItem -> pProvider -> pProviderClass -> fExpires) - { - if ((*pItem -> pProvider -> pProviderClass -> fExpires)(r, pItem -> pProvider)) - { - if (r -> Component.Config.bDebug & dbgCache) - lprintf (r -> pApp, "[%d]CACHE: %s expired because provider C sub returned TRUE\n", r -> pThread -> nPid, pItem -> sKey) ; - Cache_FreeContent (r, pItem) ; - return pItem -> bExpired = TRUE ; - } - } - if (pItem -> nExpiresInTime && pItem -> nLastModified + pItem -> nExpiresInTime < r -> nRequestTime) { if (r -> Component.Config.bDebug & dbgCache) @@ -867,6 +868,7 @@ /*in*/ bool bUseCache) { + epTHX_ int rc ; if (!bUseCache && (Cache_IsExpired (r, pItem, pItem -> nLastUpdated) || !pItem -> pSVData)) @@ -878,6 +880,8 @@ return rc ; } Cache_SetNotExpired (r, pItem) ; + if (pItem -> pSVData) + SvREFCNT_dec (pItem -> pSVData) ; pItem -> pSVData = *pData ; } else @@ -1133,7 +1137,7 @@ else { if (r -> Component.Config.bDebug & dbgCache) - lprintf (r -> pApp, "[%d]CACHE: %s take from cache\n", r -> pThread -> nPid, pItem -> sKey) ; + lprintf (r -> pApp, "[%d]CACHE: %s taken from cache\n", r -> pThread -> nPid, pItem -> sKey) ; } return ok ; } 1.13 +5 -3 embperl/epcmd2.c Index: epcmd2.c =================================================================== RCS file: /home/cvs/embperl/epcmd2.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- epcmd2.c 7 Mar 2004 20:10:06 -0000 1.12 +++ epcmd2.c 14 Aug 2004 14:28:41 -0000 1.13 @@ -343,7 +343,8 @@ sEscapedText = Escape (r, s, l, r -> Component.nCurrEscMode, NULL, '\0') ; s = SV2String (sEscapedText, l) ; - Node_appendChild (r -> pApp, pDomTree, xAttr, nRepeatLevel, ntypAttrValue, 0, s, l, 0, 0, NULL) ; + Node_appendChild (r -> pApp, pDomTree, xAttr, nRepeatLevel, ntypAttrValue, 0, s, l, 0, 0, NULL) ; + SvREFCNT_dec (sEscapedText) ; } } } @@ -378,7 +379,8 @@ sEscapedText = Escape (r, s, l, r -> Component.nCurrEscMode, NULL, '\0') ; s = SV2String (sEscapedText, l) ; - Node_appendChild (r -> pApp, pDomTree, xAttr, nRepeatLevel, ntypAttrValue, 0, s, l, 0, 0, NULL) ; + Node_appendChild (r -> pApp, pDomTree, xAttr, nRepeatLevel, ntypAttrValue, 0, s, l, 0, 0, NULL) ; + SvREFCNT_dec (sEscapedText) ; } } } 1.15 +4 -4 embperl/epcomp.c Index: epcomp.c =================================================================== RCS file: /home/cvs/embperl/epcomp.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- epcomp.c 20 Jul 2004 04:59:10 -0000 1.14 +++ epcomp.c 14 Aug 2004 14:28:41 -0000 1.15 @@ -680,7 +680,7 @@ { if (pChildNode -> bFlags & aflgAttrChilds) { - int l = sprintf (buf, "XML::Embperl::DOM::Attr::iValue ($_ep_DomTree,%ld)", pChildNode -> xNdx) ; + sprintf (buf, "XML::Embperl::DOM::Attr::iValue ($_ep_DomTree,%ld)", pChildNode -> xNdx) ; sText = buf ; if (out == 2) out = 1 ; @@ -1880,8 +1880,7 @@ { epTHX_ int rc = ok ; - /* char * sSourcefile = DomTree_filename (xSrcDomTree) ;*/ - char * sSourcefile = r -> Component.sSourcefile ; + /* char * sSourcefile = r -> Component.sSourcefile ; */ tainted = 0 ; @@ -1935,6 +1934,7 @@ pKey = hv_iterkey (pEntry, &l) ; av_push (pAV, newSVpv(pKey, l)) ; } + av_push (r -> pCleanupAV, (SV *)pAV) ; } } 1.19 +326 -29 embperl/epdom.c Index: epdom.c =================================================================== RCS file: /home/cvs/embperl/epdom.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- epdom.c 20 Jul 2004 08:25:21 -0000 1.18 +++ epdom.c 14 Aug 2004 14:28:41 -0000 1.19 @@ -20,10 +20,12 @@ /* --- don't use Perl's memory management here --- */ +#ifndef DMALLOC #undef malloc #undef realloc #undef strdup #undef free +#endif HV * pStringTableHash ; /* Hash to translate strings to index number */ @@ -40,7 +42,6 @@ static int numLevelLookupItem = 0 ; static int numAttr = 0 ; static int numStr = 0 ; -static int numPads = 0 ; static int numReplace = 0 ; tIndex xNoName = 0 ; @@ -73,9 +74,13 @@ void mydie (/*in*/ tApp * a, char * msg) { - epaTHX_ LogErrorParam (a, 9999, msg, "") ; puts (msg) ; +#ifdef EPDEBUG +#if defined (__GNUC__) && defined (__i386__) + __asm__ ("int $0x03\n") ; +#endif +#endif exit (1) ; } @@ -86,8 +91,14 @@ /* ------------------------------------------------------------------------ */ +#ifdef DMALLOC +tNodeData * dom_malloc_dbg (/*in*/ tApp * a, + size_t nSize, int * pCounter, + char * fn, int l) +#else tNodeData * dom_malloc (/*in*/ tApp * a, size_t nSize, int * pCounter) +#endif { epaTHX_ int nFree = (nSize+7)>>3 ; @@ -114,7 +125,11 @@ /* --- Pad full -> alloc new one --- */ +#ifdef DMALLOC + pMemLast = _malloc_leap(fn, l, sizeof (tPad)) ; +#else pMemLast = malloc(sizeof (tPad)) ; +#endif nMemUsage += sizeof (tPad) ; @@ -126,6 +141,13 @@ } +#ifdef DMALLOC +#undef dom_malloc +#define dom_malloc(a,n,p) dom_malloc_dbg ((a),(n),(p),__FILE__,__LINE__) +#endif + + + void dom_free (/*in*/ tApp * a, tNodeData * pNode, int * pCounter) { @@ -211,7 +233,7 @@ else { char buf[256] ; - sprintf (buf, "%zu bytes", n) ; + sprintf (buf, "%u bytes", n) ; LogErrorParam (a, rcOutOfMemory, "str_malloc failed", buf) ; } @@ -238,7 +260,7 @@ else { char buf[256] ; - sprintf (buf, "%zu bytes", n) ; + sprintf (buf, "%u bytes", n) ; LogErrorParam (a, rcOutOfMemory, "str_malloc_dbg failed", buf) ; } @@ -476,6 +498,14 @@ { struct tArrayCtrl * pCtrl = ((struct tArrayCtrl *)(*(void * *)pArray)) - 1 ; +#ifdef DMALLOC + if (strncmp (pCtrl -> sSig, "ARY ", sizeof (pCtrl -> sSig)) != 0) + { + LogErrorParam (a, rcCleanupErr, "ArrayFree Signature", pCtrl -> sSig) ; + } + strncpy (pCtrl -> sSig, "ARYFR", sizeof (pCtrl -> sSig)) ; + +#endif str_free (a, pCtrl) ; (*(void * *)pArray) = NULL ; @@ -870,7 +900,6 @@ SV * pSVNdx ; HE * pHEKey ; int nNdx ; - int bFound = 0 ; if (sText == NULL) return 0 ; @@ -945,9 +974,218 @@ } +#ifdef EPDEBUG - - +/* ------------------------------------------------------------------------ */ +/* */ +/* DEBUG support */ +/* */ +/* */ +/* */ +/* ------------------------------------------------------------------------ */ + + +#define ASSERT_DOMTREE_VALID(a,n) embperl_Assert_DomTree_Valid(a,n,"",__FILE__,__LINE__) +#define ASSERT_NODE_VALID(a,n) embperl_Assert_Node_Valid(a,n,"",__FILE__,__LINE__) +#define ASSERT_ATTR_VALID(a,n) embperl_Assert_Attr_Valid(a,n,NULL,"",__FILE__,__LINE__) + +void embperl_Assert_Node_Valid (/*in*/tApp * a, tNodeData *pNode, char * prefix, char * fn, int line) ; + + +void embperl_Assert_DomTree_Valid (/*in*/tApp * a, tDomTree *pDomTree, char * prefix, char * fn, int line) + + { + tDomTree * pLookupDomTree ; + char buf[2048] ; + + if (!pDomTree) + return ; + + if (pDomTree -> xNdx == 0) + { + sprintf(buf, "%s DomTree is deleted: %s(%d)\n", prefix, fn, line) ; + mydie (NULL, buf) ; + } + + + pLookupDomTree = DomTree_self(pDomTree -> xNdx) ; + if (pDomTree != pLookupDomTree) + { + sprintf(buf, "%sAddress of DomTree %d does not match Lookup Table: %s(%d)\n", prefix, pDomTree -> xNdx, fn, line) ; + mydie (NULL, buf) ; + } + } + +void embperl_Assert_Attr_Valid (/*in*/tApp * a, tAttrData *pAttr, tNodeData *pNode, char * prefix, char * fn, int line) + + { + tAttrData * pLookupAttr ; + tNodeData *pLookupNode ; + tDomTree *pLookupDomTree ; + char buf[2048] ; + tIndex xFirstAttr ; + + if (!pAttr) + return ; + + pLookupNode = Attr_selfNode (pAttr) ; + pLookupDomTree = DomTree_self(pLookupNode -> xDomTree) ; + pLookupAttr = Attr_self (pLookupDomTree, pAttr -> xNdx) ; + if (pAttr != pLookupAttr) + { + sprintf(buf, "%sAddress of Attr %ld does not match Lookup Table: %s(%d)\n", prefix, pAttr -> xNdx, fn, line) ; + mydie (NULL, buf) ; + } + + if (pNode) + { + if (pNode != pLookupNode) + { + sprintf(buf, "%sAddress of Node of Attr (Node %ld DomTree %d) does not match Node: %s(%d)\n", prefix, pNode -> xNdx, pNode -> xDomTree, fn, line) ; + mydie (NULL, buf) ; + } + + } + else + { + sprintf(buf, "%sAttr %ld: ", prefix, pAttr -> xNdx) ; + embperl_Assert_Node_Valid(a,pLookupNode, buf, fn, line) ; + } + + if (pAttr -> bFlags & aflgAttrChilds) + { + sprintf(buf, "%sAttr %ld aflgAttrChilds: ", prefix, pAttr -> xNdx) ; + + pLookupNode = Node_selfLevel (a, pLookupDomTree, pAttr -> xValue, pLookupNode -> nRepeatLevel) ; + + xFirstAttr = pLookupNode -> xNdx ; + + while (pLookupNode) + { + embperl_Assert_Node_Valid(a,pLookupNode, buf, fn, line) ; + + pLookupNode = Node_selfNextSibling (a, pLookupDomTree, pLookupNode, pLookupNode -> nRepeatLevel) ; + if (pLookupNode) + { + if (pLookupNode -> xNdx == xFirstAttr ) + { + sprintf(buf, "%sAttr %ld aflgAttrChilds FirstNode found second time %ld", prefix, pAttr -> xNdx, pLookupNode -> xNdx) ; + mydie (a, buf) ; + } + } + } + } + } + + +void embperl_Assert_Node_Valid (/*in*/tApp * a, tNodeData *pNode, char * prefix, char * fn, int line) + + { + tDomTree * pDomTree ; + tNodeData *pLookupNode ; + tNodeData *pFirstChild ; + tAttrData *pAttr ; + int n ; + char buf[2048] ; + + if (!pNode) + return ; + + + n = ArrayGetSize (a, pDomTrees) ; + if (pNode -> xDomTree >= n || pNode -> xDomTree < 0) + { + sprintf(buf, "%s DomTree %d out of range (max=%d): %s(%d)\n", prefix, pNode -> xDomTree, n, fn, line) ; + mydie (NULL, buf) ; + } + + + pDomTree = DomTree_self (pNode -> xDomTree) ; + sprintf(buf, "%sDomTree of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ; + embperl_Assert_DomTree_Valid(a,pDomTree, buf, fn, line) ; + + pLookupNode = Node_selfLevel(a, pDomTree, pNode -> xNdx, pNode -> nRepeatLevel) ; + if (pNode != pLookupNode) + { + sprintf(buf, "%sAddress of Node %ld DomTree %d does not match Lookup Table: %s(%d)\n", prefix, pNode -> xNdx, pNode -> xDomTree, fn, line) ; + mydie (NULL, buf) ; + } + + + if (pNode -> xChilds && pNode -> nType != ntypDocumentFraq && pNode -> nType != ntypDocument) + { + tIndex xNull = xNode_selfLevelNull(pDomTree, pNode) ; + pLookupNode = Node_self(pDomTree, xNull) ; + pFirstChild = Node_selfLevel(a, pDomTree, pNode -> xChilds, pNode -> nRepeatLevel) ; + if (pFirstChild -> xParent != pNode -> xNdx && pFirstChild -> xParent != xNull) + { + sprintf(buf, "%sParent (xParent=%ld) of first Child (Node %ld DomTree %d) does not point to myself (Node %ld DomTree %d NullNode=%ld): %s(%d)\n", + prefix, pFirstChild -> xParent, pFirstChild -> xNdx, pFirstChild -> xDomTree, pNode -> xNdx, pNode -> xDomTree, + xNull, fn, line) ; + mydie (NULL, buf) ; + } + + if (pNode -> nRepeatLevel > 0 && pFirstChild -> xParent != pNode -> xNdx) + { + tNodeData * pParent = Node_selfLevel(a, pDomTree, pFirstChild -> xParent, pNode -> nRepeatLevel) ; + if (pNode != pParent ) + { + sprintf(buf, "%sLevel %d Level Parent of first Child (Node %ld DomTree %d) does not point to myself (Node %ld) but to Node %ld: %s(%d)\n", + prefix, pNode -> nRepeatLevel, pFirstChild -> xNdx, + pFirstChild -> xDomTree, pNode -> xNdx, pParent -> xNdx, fn, line) ; + mydie (NULL, buf) ; + } + + + } + } + + if (!*prefix && pNode -> xParent) + { + sprintf(buf, "%sParent of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ; + pLookupNode = Node_selfLevel(a, pDomTree, pNode -> xParent, pNode -> nRepeatLevel) ; + + if (pLookupNode -> nType == ntypAttr) + embperl_Assert_Attr_Valid(a, (tAttrData *)pLookupNode, NULL, buf, fn, line) ; + else + embperl_Assert_Node_Valid(a, pLookupNode, buf, fn, line) ; + } + + if (!*prefix && pNode -> xNext) + { + sprintf(buf, "%sNext of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ; + pLookupNode = Node_selfLevel(a, pDomTree, pNode -> xNext, pNode -> nRepeatLevel) ; + embperl_Assert_Node_Valid(a,pLookupNode, buf, fn, line) ; + } + + if (!*prefix && pNode -> xPrev) + { + sprintf(buf, "%sPrev of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ; + pLookupNode = Node_selfLevel(a, pDomTree, pNode -> xPrev, pNode -> nRepeatLevel) ; + embperl_Assert_Node_Valid(a,pLookupNode, buf, fn, line) ; + } + + pAttr = (tAttrData * )(pNode + 1) ; + n = pNode -> numAttr ; + + sprintf(buf, "%sAttr of Node %ld DomTree %d: ", prefix, pNode -> xNdx, pNode -> xDomTree) ; + while (n) + { + embperl_Assert_Attr_Valid(a,pAttr, pNode, buf, fn, line) ; + n-- ; + pAttr++ ; + } + + } + + + + +#else +#define ASSERT_DOMTREE_VALID(a,n) +#define ASSERT_NODE_VALID(a,n) +#define ASSERT_ATTR_VALID(a,n) +#endif /* ------------------------------------------------------------------------ */ /* */ @@ -966,6 +1204,33 @@ SV * pSVNdx ; HE * pHEKey ; + + tNodeData testnode ; + tAttrData testattr ; + + if (((char *)(&testnode.nType) - (char *)&testnode) != + ((char *)(&testattr.nType) - (char *)&testattr)) + { + mydie (a, "Attr.nType and Node.nType are not at the same offset. There is a problem with the typedefinitions in epdom.h") ; + } + + if (((char *)(&testnode.xNdx) - (char *)&testnode) != + ((char *)(&testattr.xNdx) - (char *)&testattr)) + { + mydie (a, "Attr.xNdx and Node.xNdx are not at the same offset. There is a problem with the typedefinitions in epdom.h") ; + } + + if (((char *)(&testnode.xChilds) - (char *)&testnode) != + ((char *)(&testattr.xValue) - (char *)&testattr)) + { + mydie (a, "Attr.xValue and Node.xChilds are not at the same offset. There is a problem with the typedefinitions in epdom.h") ; + } + + if (sizeof(testnode.xChilds) != sizeof (testattr.xValue)) + { + mydie (a, "Attr.xValue and Node.xChilds do not have the same size. There is a problem with the typedefinitions in epdom.h") ; + } + pStringTableHash = newHV () ; ArrayNew (a, &pStringTableArray, 256, sizeof (HE *)) ; @@ -1187,7 +1452,6 @@ pLookupLevelNodeLevel++ ; } - dom_free_size (a, pLookupLevelNode, sizeof (tRepeatLevelLookup) + sizeof (tRepeatLevelLookupItem) * (pLookupLevelNode -> numItems - 1), &numLevelLookup) ; } @@ -1204,16 +1468,16 @@ if (pDomTree -> pDependsOn) { - /* int i ; - for (i = 0 ; i < AvFILL (pDomTree -> pDependsOn); i++) + for (i = 0 ; i <= AvFILL (pDomTree -> pDependsOn); i++) { SV * pSV = *av_fetch (pDomTree -> pDependsOn, i, 0) ; - lprintf (a, "pDependsOn #%d type = %d\n", i, SvTYPE(pSV)) ; + /* ### */ lprintf (a, "pDependsOn DomTree #%d type = %d cnt=%d n=%d\n", i, SvTYPE(pSV), SvREFCNT(pSV), SvIVX(pSV)) ; } + av_clear (pDomTree -> pDependsOn) ; - */ + SvREFCNT_dec (pDomTree -> pDependsOn) ; } @@ -1299,7 +1563,7 @@ ArrayClone (a, &pOrgDomTree -> pLookup, &pDomTree -> pLookup) ; ArrayClone (a, &pOrgDomTree -> pCheckpoints, &pDomTree -> pCheckpoints) ; - if (pDomTree -> pSV = pOrgDomTree -> pSV) + if ((pDomTree -> pSV = pOrgDomTree -> pSV)) SvREFCNT_inc (pDomTree -> pSV) ; pDocument = Node_self (pDomTree, pDomTree -> xDocument) ; @@ -1705,7 +1969,7 @@ -/*--------------------------------------------------------------------------- +/*--------------------------------------------------------------------------*/ /* */ /* DomTree_discardAfterCheckpoint */ /* */ @@ -1973,6 +2237,8 @@ tNode xNewNode ; tNodeData * pNew ; + ASSERT_NODE_VALID(a,pNode) ; + if ((pNew = dom_malloc (a, len, &numNodes)) == NULL) return NULL ; @@ -2011,6 +2277,7 @@ if (bDeep < 1) pNew -> xChilds = 0 ; + return pNew ; } @@ -2121,11 +2388,14 @@ tRepeatLevelLookup * pLookupLevelNode ; tRepeatLevelLookupItem * pLookupLevelNodeLevel ; + ASSERT_NODE_VALID(a,pNode) ; if (pNode -> xDomTree == pDomTree -> xNdx && pNode -> nRepeatLevel == nRepeatLevel) return pNode ; - + +/* lprintf(a, "selfCondCloneNode 1 node=%d repeatlevel=%d\n", pNode -> xNdx, nRepeatLevel) ; */ + if (nRepeatLevel == 0) { pLookup = pDomTree -> pLookup ; @@ -2135,6 +2405,8 @@ if ((pLookup[xNdx].pLookup = pNew = dom_malloc (a, len, &numNodes)) == NULL) return NULL ; + ASSERT_NODE_VALID(a,pNode) ; + memcpy (pNew, pNode, len) ; pNew -> xDomTree = pDomTree -> xNdx ; @@ -2156,6 +2428,8 @@ pAttr++ ; } + ASSERT_NODE_VALID(a,pNew) ; + return pNew ; } @@ -2167,7 +2441,7 @@ if (!pLookupLevelNode) { if ((pLookupLevelNode = pLookup[pNode -> xNdx].pLookupLevel = - (tRepeatLevelLookup *)dom_malloc (a, sizeof (tRepeatLevelLookup) + sizeof (tRepeatLevelLookupItem) * LEVELHASHSIZE - 1, &numLevelLookup)) == NULL) + (tRepeatLevelLookup *)dom_malloc (a, sizeof (tRepeatLevelLookup) + sizeof (tRepeatLevelLookupItem) * (LEVELHASHSIZE - 1), &numLevelLookup)) == NULL) return NULL ; pLookupLevelNode -> nMask = LEVELHASHSIZE - 1 ; pLookupLevelNode -> numItems = LEVELHASHSIZE ; @@ -2191,6 +2465,8 @@ { pLookupLevelNodeLevel -> pNode = pNew ; } + + ASSERT_NODE_VALID(a,pNew) ; return pNew ; } @@ -2710,7 +2986,6 @@ { epaTHX_ - tNode xOrgChild = xOldChild ; tNodeData * pNode = Node_selfLevel (a, pDomTree, xNode, nRepeatLevel) ; tNodeData * pOldChild = Node_selfCondCloneNode (a, pOldChildDomTree, Node_selfLevel (a, pOldChildDomTree, xOldChild, nOldRepeatLevel), nOldRepeatLevel) ; int len = sizeof (tNodeData) + pNode -> numAttr * sizeof (tAttrData) ; @@ -3058,7 +3333,6 @@ { tNodeData * pOldChild ; - tNode xOrgChild = xOldChild ; tStringIndex n ; numReplace++ ; @@ -3664,8 +3938,6 @@ { - int nOrderNdx = 0 ; - Node_toString2 (r, pDomTree, xNode, &nRepeatLevel) ; } @@ -3825,6 +4097,7 @@ tNodeData * pNewNode ; pNode = Node_selfCondCloneNode (a, pDomTree, pNode, nRepeatLevel) ; + pAttr = Element_selfGetAttribut (a, pDomTree, pNode, sAttrName, nAttrNameLen) ; if (pAttr) @@ -3973,38 +4246,62 @@ { struct tNodeData * pNode ; struct tNodeData * pAttrNode ; - - if (!pAttr) + tIndex xFirstAttr ; + + ASSERT_ATTR_VALID(a,pAttr) ; + + if (!pAttr) return NULL ; +/* lprintf (a, "selvalue 1 f=%x a=%x aa=%x an=%d off=%d av=%d\n", pAttr -> bFlags , aflgAttrChilds, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue) ; */ pAttrNode = Attr_selfNode(pAttr) ; + ASSERT_NODE_VALID(a,pAttrNode) ; + +/* lprintf (a, "selvalue f=%x a=%x aa=%x an=%d off=%d av=%d na=%x nn=%d a\n", pAttr -> bFlags , aflgAttrChilds, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue, pAttrNode, pAttrNode -> xNdx) ; */ + + pNode = Node_selfLevel (a, pDomTree, pAttrNode -> xNdx, nRepeatLevel) ; + ASSERT_NODE_VALID(a,pNode) ; + +/* lprintf (a, "selvalue f=%x a=%x aa=%x an=%d off=%d av=%d na=%x nn=%d node=%x\n", pAttr -> bFlags , aflgAttrChilds, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue, pAttrNode, pAttrNode -> xNdx, pNode) ;*/ + + if (pNode != pAttrNode) { pAttr = Element_selfGetAttribut (a, pDomTree, pNode, NULL, pAttr -> xName) ; if (!pAttr) return NULL ; } - - - if (!(pAttr -> bFlags & aflgAttrChilds)) - return Ndx2String (pAttr -> xValue) ; + ASSERT_ATTR_VALID(a,pAttr) ; + ASSERT_NODE_VALID(a,pNode) ; + ASSERT_NODE_VALID(a,pAttrNode) ; + +/*lprintf (a, "selvalue f=%x a=%x aa=%x an=%d off=%d av=%d na=%x nn=%d a\n", pAttr -> bFlags , aflgAttrChilds, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue, pAttrNode, pAttrNode -> xNdx) ;*/ + if ((pAttr -> bFlags & aflgAttrChilds) == 0) + return Ndx2String (pAttr -> xValue) ; pNode = Node_selfLevel (a, pDomTree, pAttr -> xValue, nRepeatLevel) ; StringNew (a, ppAttr, 512) ; - + xFirstAttr = pNode -> xNdx ; + while (pNode) { char * s ; int l ; + + ASSERT_NODE_VALID(a,pNode) ; + +/*lprintf (a, "selvalue f=%x node=%x nodendx=%d aa=%x an=%d off=%d av=%d na=%x nn=%d a\n", pAttr -> bFlags , pNode, pNode -> xNdx, pAttr, pAttr -> xNdx, pAttr -> nNodeOffset, pAttr -> xValue, pAttrNode, pAttrNode -> xNdx) ;*/ - if ((pNode -> bFlags & nflgIgnore) == 0) + if ((pNode -> bFlags & nflgIgnore) == 0) { Ndx2StringLen (pNode -> nText,s,l) ; StringAdd (a, ppAttr, s, l) ; } pNode = Node_selfNextSibling (a, pDomTree, pNode, nRepeatLevel) ; + if (!pNode || pNode -> xNdx == xFirstAttr) + break ; } return *ppAttr ; 1.35 +13 -1 embperl/epeval.c Index: epeval.c =================================================================== RCS file: /home/cvs/embperl/epeval.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- epeval.c 20 Jul 2004 04:59:10 -0000 1.34 +++ epeval.c 14 Aug 2004 14:28:42 -0000 1.35 @@ -196,6 +196,9 @@ LogErrorParam (a, rcEvalErr, s, sContext) ; return rcEvalErr ; } +#ifdef DMALLOC + AddDMallocMagic (*pCV, s?s:"EvalConfig", __FILE__, __LINE__) ; +#endif return ok ; } @@ -281,6 +284,9 @@ { *ppCV = (CV *)SvRV (pRV) ; SvREFCNT_inc (*ppCV) ; +#ifdef DMALLOC + AddDMallocMagic (*ppCV, sRegex?sRegex:"EvalRegEx", __FILE__, __LINE__) ; +#endif } else *ppCV = NULL ; @@ -479,6 +485,9 @@ r -> TableStack.State.nColUsed || r -> TableStack.State.nRowUsed)) lprintf (r -> pApp, "[%d]TAB: nResult = %d\n", r -> pThread -> nPid, r -> TableStack.State.nResult) ; +#ifdef DMALLOC + AddDMallocMagic (*pRet, sArg?sArg:"CallCV", __FILE__, __LINE__) ; +#endif #endif } else if (num == 0) @@ -758,6 +767,9 @@ else lprintf (r -> pApp, "[%d]EVAL> <undefined>\n", r -> pThread -> nPid) ; } +#ifdef DMALLOC + AddDMallocMagic (*pRet, sArg?sArg:"CallStoredCV", __FILE__, __LINE__) ; +#endif } else if (num == 0) { 1.16 +27 -22 embperl/epinit.c Index: epinit.c =================================================================== RCS file: /home/cvs/embperl/epinit.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- epinit.c 9 Aug 2004 19:44:44 -0000 1.15 +++ epinit.c 14 Aug 2004 14:28:42 -0000 1.16 @@ -248,7 +248,11 @@ pThread -> pFormArrayGV = *((GV **)hv_fetch (pStash, FFLD_NAME, sizeof (FFLD_NAME) - 1, 0)) ; pThread -> pHeaderHash = perl_get_hv (EMBPERL_HDR_NAME, TRUE) ; pThread -> pInputHash = perl_get_hv (EMBPERL_IDAT_NAME, TRUE) ; - pThread -> pEnvHash = perl_get_hv (EMBPERL_ENV_NAME, TRUE) ; +#ifdef DMALLOC + pThread -> pEnvHash = Perl_get_hv(aTHX_ EMBPERL_ENV_NAME, TRUE) ; +#else + pThread -> pEnvHash = perl_get_hv (EMBPERL_ENV_NAME, TRUE) ; +#endif pThread -> pParamArray = perl_get_av (EMBPERL_PARAM_NAME, TRUE) ; pThread -> pParamArrayGV = *((GV **)hv_fetch (pStash, PARAM_NAME, sizeof (PARAM_NAME) - 1, 0)) ; pThread -> pReqRV = perl_get_sv (EMBPERL_REQ_NAME, TRUE) ; @@ -1256,9 +1260,6 @@ time_t t = time(NULL) ; lprintf (r -> pApp, "[%d]REQ: ***** Start Request at %s", r -> pThread -> nPid, ctime (&t)) ; lprintf (r -> pApp, "[%d]Use App: %s\n", r -> pApp -> pThread -> nPid, r -> pApp -> Config.sAppName) ; -#ifdef DMALLOC - dmalloc_message ("[%d]REQ: Start Request at %s\n", r -> pThread -> nPid, ctime (&t)) ; -#endif } @@ -1373,13 +1374,6 @@ r -> pPerlTHX = aTHX ; #endif -#if defined (_MDEBUG) && defined (WIN32) - _CrtMemCheckpoint(&r -> MemCheckpoint); -#endif -#ifdef DMALLOC - r -> MemCheckpoint = dmalloc_mark () ; -#endif - #ifdef APACHE @@ -1734,12 +1728,24 @@ av_clear (r -> pThread -> pFormArray) ; hv_clear (r -> pThread -> pFormHash) ; hv_clear (r -> pThread -> pFormSplitHash) ; + for (i = 0 ; i <= av_len (r -> pDomTreeAV); i++) + { + SV ** ppSV = av_fetch (r -> pDomTreeAV, i, 0) ; + SV * pSV = * ppSV ; +/* ### */ lprintf (r -> pApp, "r -> pDomTreeAV DomTree #%d type = %d cnt=%d n=%d\n", i, SvTYPE(pSV), SvREFCNT(pSV), SvIVX(pSV)) ; + } av_clear (r -> pDomTreeAV) ; SvREFCNT_dec (r -> pDomTreeAV) ; for (i = 0 ; i <= av_len (r -> pCleanupAV); i++) { - sv_setsv (SvRV(*av_fetch (r -> pCleanupAV, i, 0)), &sv_undef) ; + SV ** ppSV = av_fetch (r -> pCleanupAV, i, 0) ; + SV * pSV = * ppSV ; + if (SvROK(pSV)) +/* ### */ lprintf (r -> pApp, "r -> pCleanupAV DomTree #%d type = %d cnt=%d n=%d\n", i, SvTYPE(SvRV(pSV)), SvREFCNT(SvRV(pSV)), SvIVX(SvRV(pSV))) ; + if (SvROK(pSV)) + sv_setsv (SvRV(pSV), &sv_undef) ; } + av_clear (r -> pCleanupAV) ; Cache_CleanupRequest (r) ; @@ -1791,15 +1797,6 @@ ep_destroy_pool (r -> pPool) ; sv_setpv(ERRSV,""); -#if defined (_MDEBUG) && defined (WIN32) - _CrtMemDumpAllObjectsSince(&r -> MemCheckpoint); -#endif -#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 -> pThread -> nPid, - (r -> Component.pPrev?"Sub-":""), r -> stsv_count, /*r -> stsv_objcount, */sv_count/*, sv_objcount*/) ; -#endif if (r -> Config.bDebug) DomStats (r -> pApp) ; @@ -2153,9 +2150,13 @@ { strncpy (r -> errdat1, SvPV(args[0], l), sizeof(r -> errdat1) - 1) ; SvREFCNT_dec(args[0]) ; + if (pRet) + SvREFCNT_dec(pRet) ; LogError (r, rcForbidden) ; return rcForbidden ; } + if (pRet) + SvREFCNT_dec(pRet) ; } if (r -> Config.pUriMatch) @@ -2165,8 +2166,12 @@ { strncpy (r -> errdat1, SvPV(args[0], l), sizeof(r -> errdat1) - 1) ; SvREFCNT_dec(args[0]) ; + if (pRet) + SvREFCNT_dec(pRet) ; return rcDecline ; } + if (pRet) + SvREFCNT_dec(pRet) ; } SvREFCNT_dec(args[0]) ; } 1.128 +39 -1 embperl/epmain.c Index: epmain.c =================================================================== RCS file: /home/cvs/embperl/epmain.c,v retrieving revision 1.127 retrieving revision 1.128 diff -u -r1.127 -r1.128 --- epmain.c 23 Jan 2004 06:50:55 -0000 1.127 +++ epmain.c 14 Aug 2004 14:28:42 -0000 1.128 @@ -1414,13 +1414,51 @@ int rc ; tReq * r = NULL ; +#ifdef DMALLOC + time_t t = time(NULL) ; + unsigned long nMemCheckpoint ; + dmalloc_message ("[%d]REQ: Start Request at %s\n", getpid(), ctime (&t)) ; +#endif + +#if defined (_MDEBUG) && defined (WIN32) + _CrtMemCheckpoint(&r -> MemCheckpoint); +#endif +#ifdef DMALLOC + nMemCheckpoint = dmalloc_mark () ; +#endif + + ENTER; + SAVETMPS ; + rc = embperl_InitRequestComponent (aTHX_ pApacheReqSV, pPerlParam, &r) ; +#ifdef DMALLOC + r -> MemCheckpoint = nMemCheckpoint; +#endif + if (rc == ok) rc = embperl_RunRequest (r) ; +#ifdef DMALLOC + dmalloc_message ( "[%d]%sRequest will be freed. Entry-SVs: %d: %%d\n", r -> pThread -> nPid, + (r -> Component.pPrev?"Sub-":""), r -> stsv_count) ; +#endif + if (r) embperl_CleanupRequest (r) ; + + FREETMPS ; + LEAVE; + +#if defined (_MDEBUG) && defined (WIN32) + _CrtMemDumpAllObjectsSince(&r -> MemCheckpoint); +#endif +#ifdef DMALLOC + /* unsigned long mark, int not_freed_b, int freed_b, int details_b */ + dmalloc_log_changed (nMemCheckpoint, 1, 0, 1) ; + dmalloc_message ( "[%d]Request freed. Exit-SVs: %d -OBJs: %d\n", getpid(), + sv_count, sv_objcount) ; +#endif return rc ; } 1.4 +3 -1 embperl/epmem.c Index: epmem.c =================================================================== RCS file: /home/cvs/embperl/epmem.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- epmem.c 23 Jan 2004 06:50:55 -0000 1.3 +++ epmem.c 14 Aug 2004 14:28:42 -0000 1.4 @@ -114,10 +114,12 @@ /* --- don't use Perl's memory management and io layer here --- */ +#ifndef DMALLOC #undef malloc #undef free #undef fprintf #undef exit +#endif /* debugging support, define this to enable code which helps detect re-use * of freed memory and other such nonsense. 1.5 +7 -3 embperl/epprovider.c Index: epprovider.c =================================================================== RCS file: /home/cvs/embperl/epprovider.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- epprovider.c 23 Jan 2004 06:50:55 -0000 1.4 +++ epprovider.c 14 Aug 2004 14:28:42 -0000 1.5 @@ -1557,7 +1557,10 @@ sv_catpv (pKey, r -> Param.sPathInfo) ; if ((bKeyOptions & ckoptQueryInfo) && r -> Param.sQueryInfo) - sv_catpv (pKey, r -> Param.sQueryInfo) ; + sv_catpv (pKey, r -> Param.sQueryInfo) ; + + if (sKey) + sv_catpv (pKey, sKey) ; return ok ; } @@ -1675,7 +1678,7 @@ { LogError (r, rc) ; } - +/* ### */ lprintf (r ->pApp, "ProviderEpRun_IsExpired t=%d cv=%x\n", pProvider -> pCache -> nExpiresInTime, pProvider -> pCache -> pExpiresCV ); if (pProvider -> pCache -> nExpiresInTime || pProvider -> pCache -> pExpiresCV) pProvider -> pCache -> bCache = 1 ; else @@ -1683,6 +1686,7 @@ pProvider -> pCache -> bCache = 0 ; if (bCache) Cache_FreeContent (r, pProvider -> pCache) ; + return TRUE ; } 1.39 +5 -4 embperl/eputil.c Index: eputil.c =================================================================== RCS file: /home/cvs/embperl/eputil.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- eputil.c 9 Aug 2004 19:44:44 -0000 1.38 +++ eputil.c 14 Aug 2004 14:28:43 -0000 1.39 @@ -2050,7 +2050,7 @@ static MGVTBL DMalloc_mvtTab = { NULL, NULL, NULL, NULL, RemoveDMallocMagic } ; -#define MGTTYPE '.' +#define MGTTYPE '!' SV * AddDMallocMagic (/*in*/ SV * pSV, /*in*/ char * sText, @@ -2067,13 +2067,14 @@ if ((!SvMAGICAL(pSV) || !(pMagic = mg_find (pSV, MGTTYPE)))) { - sv_magic ((SV *)pSV, NULL, MGTTYPE, (char *)&s, sizeof (s)) ; + sv_magicext ((SV *)pSV, NULL, MGTTYPE, &DMalloc_mvtTab, (char *)&s, sizeof (s)) ; + //sv_magic ((SV *)pSV, NULL, MGTTYPE, (char *)&s, sizeof (s)) ; pMagic = mg_find (pSV, MGTTYPE) ; } if (pMagic) { - pMagic -> mg_virtual = &DMalloc_mvtTab ; + //pMagic -> mg_virtual = &DMalloc_mvtTab ; } else { 1.17 +107 -27 embperl/mod_embperl.c Index: mod_embperl.c =================================================================== RCS file: /home/cvs/embperl/mod_embperl.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- mod_embperl.c 20 Jul 2004 08:25:23 -0000 1.16 +++ mod_embperl.c 14 Aug 2004 14:28:45 -0000 1.17 @@ -377,6 +377,83 @@ } +/*--------------------------------------------------------------------------- +* embperl_ApacheConfigCleanup +*/ +/*! +* +* \_en +* Apache Cleanup DirConfig structure +* \endif +* +* \_de +* Apache Cleanup DirConfig structure +* \endif +* +* ------------------------------------------------------------------------ */ + +/* --- functions for merging configurations --- */ + +#define EPCFG_APP +#define EPCFG_REQ +#define EPCFG_COMPONENT + +#undef EPCFG_STR +#undef EPCFG_INT +#undef EPCFG_INTOPT +#undef EPCFG_BOOL +#undef EPCFG_CHAR +#undef EPCFG_CV +#undef EPCFG_SV +#undef EPCFG_HV +#undef EPCFG_AV +#undef EPCFG_REGEX + +#define EPCFG_INT EPCFG +#define EPCFG_INTOPT EPCFG +#define EPCFG_BOOL EPCFG +#define EPCFG_CHAR EPCFG +#define EPCFG_STR EPCFG + +#define EPCFG_CV EPCFG_DEC +#define EPCFG_SV EPCFG_DEC +#define EPCFG_HV EPCFG_DEC +#define EPCFG_REGEX EPCFG_DEC +#define EPCFG_AV(STRUCT,TYPE,NAME,CFGNAME,X) EPCFG_DEC(STRUCT,TYPE,NAME,CFGNAME) + +#undef EPCFG +#define EPCFG(STRUCT,TYPE,NAME,CFGNAME) + +#undef EPCFG_DEC +#define EPCFG_DEC(STRUCT,TYPE,NAME,CFGNAME) \ + if (cfg -> STRUCT.NAME) \ + { \ + SvREFCNT_dec ((SV *)(cfg -> STRUCT.NAME)) ; \ + cfg -> STRUCT.NAME = NULL ; \ + } + + +#ifdef APACHE2 +static apr_status_t embperl_ApacheConfigCleanup (void * p) +#else +static void embperl_ApacheInitCleanup (void * p) +#endif + + { + tApacheDirConfig * cfg = (tApacheDirConfig *) p ; + dTHX ; + +/* #include "epcfg.h" */ + +#ifdef APACHE2 + return OK ; +#endif + + } + + + + /*--------------------------------------------------------------------------- * embperl_GetApacheConfig @@ -421,8 +498,22 @@ static void *embperl_create_dir_config(apr_pool_t * p, char *d) { /*char buf [20] ;*/ - tApacheDirConfig *cfg = (tApacheDirConfig *) ap_pcalloc(p, sizeof(tApacheDirConfig)); - + tApacheDirConfig *cfg ; + apr_pool_t * subpool ; + +#ifdef APACHE2 + apr_pool_sub_make(&subpool, p, NULL); +#else + subpool = ap_make_sub_pool(p); +#endif + cfg = (tApacheDirConfig *) ap_pcalloc(subpool, sizeof(tApacheDirConfig)); + +#ifdef APACHE2 + apr_pool_cleanup_register(subpool, cfg, embperl_ApacheConfigCleanup, embperl_ApacheConfigCleanup); +#else + ap_register_cleanup(subpool, cfg, embperl_ApacheConfigCleanup, embperl_ApacheConfigCleanup); +#endif + embperl_DefaultReqConfig (&cfg -> ReqConfig) ; embperl_DefaultAppConfig (&cfg -> AppConfig) ; embperl_DefaultComponentConfig (&cfg -> ComponentConfig) ; @@ -751,7 +842,8 @@ ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, APLOG_STATUSCODE NULL, "EmbperlDebug: Get: about to convert "#CFGNAME" (type="#TYPE";SV) to perl data: %s\n", pDirCfg -> save_##STRUCT##NAME) ; \ \ pDirCfg -> STRUCT.NAME = newSVpv((char *)pDirCfg -> save_##STRUCT##NAME, 0) ; \ - } + } \ + SvREFCNT_inc((SV *)(pDirCfg -> STRUCT.NAME)) ; #undef EPCFG_CV #define EPCFG_CV(STRUCT,TYPE,NAME,CFGNAME) \ @@ -764,7 +856,8 @@ if ((rc = EvalConfig (pApp, sv_2mortal(newSVpv(pDirCfg -> save_##STRUCT##NAME, 0)), 0, NULL, "Configuration: EMBPERL_"#CFGNAME, &pDirCfg -> STRUCT.NAME)) != ok) \ LogError (pReq, rc) ; \ return rc ; \ - } + } \ + SvREFCNT_inc((SV *)(pDirCfg -> STRUCT.NAME)) ; #undef EPCFG_AV @@ -776,7 +869,8 @@ \ pDirCfg -> STRUCT.NAME = embperl_String2AV(pApp, pDirCfg -> save_##STRUCT##NAME, SEPARATOR) ;\ tainted = 0 ; \ - } + } \ + SvREFCNT_inc((SV *)(pDirCfg -> STRUCT.NAME)) ; #undef EPCFG_HV @@ -788,7 +882,8 @@ \ pDirCfg -> STRUCT.NAME = embperl_String2HV(pApp, pDirCfg -> save_##STRUCT##NAME, ' ', NULL) ;\ tainted = 0 ; \ - } + } \ + SvREFCNT_inc((SV *)(pDirCfg -> STRUCT.NAME)) ; #undef EPCFG_REGEX @@ -802,7 +897,8 @@ if ((rc = EvalRegEx (pApp, pDirCfg -> save_##STRUCT##NAME, "Configuration: EMBPERL_"#CFGNAME, &pDirCfg -> STRUCT.NAME)) != ok) \ return rc ; \ tainted = 0 ; \ - } + } \ + SvREFCNT_inc((SV *)(pDirCfg -> STRUCT.NAME)) ; /*--------------------------------------------------------------------------- @@ -828,13 +924,7 @@ memcpy (&pConfig -> pPool + 1, &pDirCfg -> AppConfig.pPool + 1, sizeof (*pConfig) - ((tUInt8 *)(&pConfig -> pPool) - (tUInt8 *)pConfig) - sizeof (pConfig -> pPool)) ; pConfig -> bDebug = pDirCfg -> ComponentConfig.bDebug ; - if (pConfig -> pSessionArgs) - SvREFCNT_inc(pConfig -> pSessionArgs); - if (pConfig -> pSessionClasses) - SvREFCNT_inc(pConfig -> pSessionClasses); - if (pConfig -> pObjectAddpathAV) - SvREFCNT_inc(pConfig -> pObjectAddpathAV); - + if (pDirCfg -> bUseEnv) embperl_GetCGIAppConfig (pThread, pPool, pConfig, 1, 0, 0) ; } @@ -871,11 +961,7 @@ memcpy (&pConfig -> pPool + 1, &pDirCfg -> ReqConfig.pPool + 1, sizeof (*pConfig) - ((tUInt8 *)(&pConfig -> pPool) - (tUInt8 *)pConfig) - sizeof (pConfig -> pPool)) ; pConfig -> bDebug = pDirCfg -> ComponentConfig.bDebug ; pConfig -> bOptions = pDirCfg -> ComponentConfig.bOptions ; - if (pConfig -> pAllow) - SvREFCNT_inc(pConfig -> pAllow); - if (pConfig -> pPathAV) - SvREFCNT_inc(pConfig -> pPathAV); - + if (pDirCfg -> bUseEnv) embperl_GetCGIReqConfig (pApp, pPool, pConfig, 1, 0, 0) ; } @@ -912,13 +998,7 @@ #include "epcfg.h" memcpy (&pConfig -> pPool + 1, &pDirCfg -> ComponentConfig.pPool + 1, sizeof (*pConfig) - ((tUInt8 *)(&pConfig -> pPool) - (tUInt8 *)pConfig) - sizeof (pConfig -> pPool)) ; - if (pConfig -> pExpiredFunc) - SvREFCNT_inc(pConfig -> pExpiredFunc); - if (pConfig -> pCacheKeyFunc) - SvREFCNT_inc(pConfig -> pCacheKeyFunc); - if (pConfig -> pRecipe) - SvREFCNT_inc(pConfig -> pRecipe); - + if (pDirCfg -> bUseEnv) embperl_GetCGIComponentConfig (pReq, pPool, pConfig, 1, 0, 0) ; } 1.140 +4 -1 embperl/test.pl Index: test.pl =================================================================== RCS file: /home/cvs/embperl/test.pl,v retrieving revision 1.139 retrieving revision 1.140 diff -u -r1.139 -r1.140 --- test.pl 21 Apr 2004 06:11:12 -0000 1.139 +++ test.pl 14 Aug 2004 14:28:45 -0000 1.140 @@ -323,6 +323,9 @@ 'incif.htm' => { 'version' => 2, }, + 'registry/hello.htm' => { + 'modperl' => 1, + }, 'registry/Execute.htm' => { 'modperl' => 1, }, 1.1 embperl/test/cmp/hello.htm Index: hello.htm =================================================================== Hello World! 1.1 embperl/test/html/registry/hello.htm Index: hello.htm =================================================================== print "Hello World!\n" ; --------------------------------------------------------------------- To unsubscribe, e-mail: embperl-cvs-unsubscribe [at] perl For additional commands, e-mail: embperl-cvs-help [at] perl
|