summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Pit <perl@profvince.com>2008-01-03 20:26:05 +0100
committerMarcus Holland-Moritz <mhx-perl@gmx.net>2008-01-04 01:22:22 +0000
commit22f1178fc6ea7d78b2fce6108796ec629a70476b (patch)
treedb1b5b4ee2350f41eef0952ef108e64f43f5641b
parent6e449a3ab1e3bd9d7e138ca681c733e57d4daa49 (diff)
downloadperl-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.xs2
-rw-r--r--ext/Win32/Win32.xs18
-rw-r--r--mg.c2
-rw-r--r--os2/os2.c18
-rw-r--r--pp_sys.c2
-rw-r--r--win32/wince.c28
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;
}
diff --git a/mg.c b/mg.c
index d7c68c5e70..f1acc39a15 100644
--- a/mg.c
+++ b/mg.c
@@ -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));
}
}
diff --git a/os2/os2.c b/os2/os2.c
index 5c05df59b9..4ebdd509a9 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -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;
diff --git a/pp_sys.c b/pp_sys.c
index 3ee3384bac..66ca0fb50d 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -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;
}