Some fixes to modperl, most notable no with time increasing memory usage

Because some ENTER/LEAVE pair was missing, the stack perl uses for passing
arguments grew and grew.
Besides adding those calls this also fixes some more of the callback calling
code to look a little closer to the examples from perldoc.
This also fixes some warnings perl threw at us when unloading by not
making ZNC::{CONTINUE,HALT{,MODS,CORE}} mortal.

Thanks to tomaw and AnMaster for reporting and helping me debug this mem issue.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1357 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-01-29 19:11:53 +00:00
parent 9a8fbdb6e0
commit 0f0463510c
+8 -5
View File
@@ -926,6 +926,7 @@ CModPerl::EModRet CModPerl::CallBack(const PString & sHookName, const VPString &
return(CONTINUE);
dSP;
ENTER;
SAVETMPS;
PUSHMARK(SP);
@@ -957,7 +958,7 @@ CModPerl::EModRet CModPerl::CallBack(const PString & sHookName, const VPString &
PUTBACK;
int iCount = call_pv(sFuncToCall.c_str(), G_EVAL|G_SCALAR);
int iCount = call_pv(sFuncToCall.c_str(), G_EVAL|G_SCALAR|G_KEEPERR);
SPAGAIN;
int iRet = CONTINUE;
@@ -969,6 +970,7 @@ CModPerl::EModRet CModPerl::CallBack(const PString & sHookName, const VPString &
if (eCBType == CB_TIMER)
iRet = HALT;
POPs;
} else
{
if (iCount == 1)
@@ -977,6 +979,7 @@ CModPerl::EModRet CModPerl::CallBack(const PString & sHookName, const VPString &
PUTBACK;
FREETMPS;
LEAVE;
return((CModPerl::EModRet)iRet);
}
@@ -1039,10 +1042,10 @@ bool CModPerl::OnLoad(const CString & sArgs, CString & sMessage)
sv_2mortal((SV*)pZNCSpace);
newCONSTSUB(pZNCSpace, "CONTINUE", PString(CONTINUE).GetSV());
newCONSTSUB(pZNCSpace, "HALT", PString(HALT).GetSV());
newCONSTSUB(pZNCSpace, "HALTMODS", PString(HALTMODS).GetSV());
newCONSTSUB(pZNCSpace, "HALTCORE", PString(HALTCORE).GetSV());
newCONSTSUB(pZNCSpace, "CONTINUE", PString(CONTINUE).GetSV(false));
newCONSTSUB(pZNCSpace, "HALT", PString(HALT).GetSV(false));
newCONSTSUB(pZNCSpace, "HALTMODS", PString(HALTMODS).GetSV(false));
newCONSTSUB(pZNCSpace, "HALTCORE", PString(HALTCORE).GetSV(false));
return(true);
}