mirror of
https://github.com/znc/znc.git
synced 2026-07-04 08:51:14 +02:00
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:
+8
-5
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user