diff options
author | Vincent Pit <perl@profvince.com> | 2008-01-03 20:26:05 +0100 |
---|---|---|
committer | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2008-01-04 01:22:22 +0000 |
commit | 22f1178fc6ea7d78b2fce6108796ec629a70476b (patch) | |
tree | db1b5b4ee2350f41eef0952ef108e64f43f5641b | |
parent | 6e449a3ab1e3bd9d7e138ca681c733e57d4daa49 (diff) | |
download | perl-22f1178fc6ea7d78b2fce6108796ec629a70476b.tar.gz |
Re: SV leak?
Message-ID: <477D28BD.5060801@profvince.com>
Mortalize SVs that are being pushed on the stack.
Try to use specialized macros for pushing mortals.
p4raw-id: //depot/perl@32822
-rw-r--r-- | ext/B/B.xs | 2 | ||||
-rw-r--r-- | ext/Win32/Win32.xs | 18 | ||||
-rw-r--r-- | mg.c | 2 | ||||
-rw-r--r-- | os2/os2.c | 18 | ||||
-rw-r--r-- | pp_sys.c | 2 | ||||
-rw-r--r-- | win32/wince.c | 28 |
6 files changed, 35 insertions, 35 deletions
diff --git a/ext/B/B.xs b/ext/B/B.xs index 8f221223e9..30635f73c4 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -2011,7 +2011,7 @@ HvARRAY(hv) (void)hv_iterinit(hv); EXTEND(sp, HvKEYS(hv) * 2); while ((sv = hv_iternextsv(hv, &key, &len))) { - PUSHs(newSVpvn(key, len)); + mPUSHp(key, len); PUSHs(make_sv_object(aTHX_ sv_newmortal(), sv)); } } diff --git a/ext/Win32/Win32.xs b/ext/Win32/Win32.xs index 9d0142d6f5..d6c80630f2 100644 --- a/ext/Win32/Win32.xs +++ b/ext/Win32/Win32.xs @@ -1245,17 +1245,17 @@ XS(w32_GetOSVersion) if (GIMME_V == G_SCALAR) { XSRETURN_IV(g_osver.dwPlatformId); } - XPUSHs(newSVpvn(g_osver.szCSDVersion, strlen(g_osver.szCSDVersion))); + mXPUSHp(g_osver.szCSDVersion, strlen(g_osver.szCSDVersion)); - XPUSHs(newSViv(g_osver.dwMajorVersion)); - XPUSHs(newSViv(g_osver.dwMinorVersion)); - XPUSHs(newSViv(g_osver.dwBuildNumber)); - XPUSHs(newSViv(g_osver.dwPlatformId)); + mXPUSHi(g_osver.dwMajorVersion); + mXPUSHi(g_osver.dwMinorVersion); + mXPUSHi(g_osver.dwBuildNumber); + mXPUSHi(g_osver.dwPlatformId); if (g_osver_ex) { - XPUSHs(newSViv(g_osver.wServicePackMajor)); - XPUSHs(newSViv(g_osver.wServicePackMinor)); - XPUSHs(newSViv(g_osver.wSuiteMask)); - XPUSHs(newSViv(g_osver.wProductType)); + mXPUSHi(g_osver.wServicePackMajor); + mXPUSHi(g_osver.wServicePackMinor); + mXPUSHi(g_osver.wSuiteMask); + mXPUSHi(g_osver.wProductType); } PUTBACK; } @@ -2829,7 +2829,7 @@ Perl_sighandler(int sig) #endif EXTEND(SP, 2); PUSHs((SV*)rv); - PUSHs(newSVpvn((char *)sip, sizeof(*sip))); + mPUSHp((char *)sip, sizeof(*sip)); } } @@ -4360,10 +4360,10 @@ XS(XS_OS2_pipeCntl) &PipeState), "DosPeekNPipe() for state"); if (state) { EXTEND(SP, 3); - PUSHs(newSVuv(PipeState)); + mPUSHu(PipeState); /* Bytes (available/in-message) */ - PUSHs(newSViv(BytesAvail.cbpipe)); - PUSHs(newSViv(BytesAvail.cbmessage)); + mPUSHi(BytesAvail.cbpipe); + mPUSHi(BytesAvail.cbmessage); XSRETURN(3); } else if (info) { /* L S S C C C/Z* @@ -4390,12 +4390,12 @@ XS(XS_OS2_pipeCntl) else size = strlen(b.pInfo.szName); EXTEND(SP, 6); - PUSHs(newSVpvn(b.pInfo.szName, size)); - PUSHs(newSVuv(b.id)); - PUSHs(newSViv(b.pInfo.cbOut)); - PUSHs(newSViv(b.pInfo.cbIn)); - PUSHs(newSViv(b.pInfo.cbMaxInst)); - PUSHs(newSViv(b.pInfo.cbCurInst)); + mPUSHp(b.pInfo.szName, size); + mPUSHu(b.id); + mPUSHi(b.pInfo.cbOut); + mPUSHi(b.pInfo.cbIn); + mPUSHi(b.pInfo.cbMaxInst); + mPUSHi(b.pInfo.cbCurInst); XSRETURN(6); } else if (BytesAvail.cbpipe == 0) { XSRETURN_NO; @@ -4701,7 +4701,7 @@ PP(pp_ghostent) } #else if (hent->h_addr) - PUSHs(newSVpvn(hent->h_addr, len)); + mPUSHp(hent->h_addr, len); else PUSHs(sv_mortalcopy(&PL_sv_no)); #endif /* h_addr */ diff --git a/win32/wince.c b/win32/wince.c index 60a6809664..103a66534c 100644 --- a/win32/wince.c +++ b/win32/wince.c @@ -2440,12 +2440,12 @@ XS(w32_GetOSVersion) if (!XCEGetVersionExA(&osver)) { XSRETURN_EMPTY; } - XPUSHs(newSVpvn(osver.szCSDVersion, strlen(osver.szCSDVersion))); - XPUSHs(newSViv(osver.dwMajorVersion)); - XPUSHs(newSViv(osver.dwMinorVersion)); - XPUSHs(newSViv(osver.dwBuildNumber)); + mXPUSHp(osver.szCSDVersion, strlen(osver.szCSDVersion)); + mXPUSHi(osver.dwMajorVersion); + mXPUSHi(osver.dwMinorVersion); + mXPUSHi(osver.dwBuildNumber); /* WINCE = 3 */ - XPUSHs(newSViv(osver.dwPlatformId)); + mXPUSHi(osver.dwPlatformId); PUTBACK; } @@ -2554,15 +2554,15 @@ XS(w32_GetPowerStatus) XSRETURN_EMPTY; } - XPUSHs(newSViv(sps.ACLineStatus)); - XPUSHs(newSViv(sps.BatteryFlag)); - XPUSHs(newSViv(sps.BatteryLifePercent)); - XPUSHs(newSViv(sps.BatteryLifeTime)); - XPUSHs(newSViv(sps.BatteryFullLifeTime)); - XPUSHs(newSViv(sps.BackupBatteryFlag)); - XPUSHs(newSViv(sps.BackupBatteryLifePercent)); - XPUSHs(newSViv(sps.BackupBatteryLifeTime)); - XPUSHs(newSViv(sps.BackupBatteryFullLifeTime)); + mXPUSHi(sps.ACLineStatus); + mXPUSHi(sps.BatteryFlag); + mXPUSHi(sps.BatteryLifePercent); + mXPUSHi(sps.BatteryLifeTime); + mXPUSHi(sps.BatteryFullLifeTime); + mXPUSHi(sps.BackupBatteryFlag); + mXPUSHi(sps.BackupBatteryLifePercent); + mXPUSHi(sps.BackupBatteryLifeTime); + mXPUSHi(sps.BackupBatteryFullLifeTime); PUTBACK; } |