cvs commit: ponie/perl sv.c
[email protected] (Nicholas Clark) 23 Apr 2005 13:40:45 -0000
| Newsgroups | perl.ponie.changes |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 05/04/23 06:40:45
Modified: perl sv.c
Log:
Pull in 24254 from blead. (Remove duplicate zero initialisation in sv_upgrade)
Revision Changes Path
1.63 +17 -42 ponie/perl/sv.c
Index: sv.c
===================================================================
RCS file: /cvs/public/ponie/perl/sv.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- sv.c 19 Apr 2005 21:23:13 -0000 1.62
+++ sv.c 23 Apr 2005 13:40:45 -0000 1.63
@@ -1805,15 +1805,14 @@
bool
Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt)
{
-
- char* pv = NULL;
- SV* rv = NULL;
- U32 cur = 0;
- U32 len = 0;
- IV iv = 0;
- NV nv = 0.0;
- MAGIC* magic = NULL;
- HV* stash = Nullhv;
+ char* pv;
+ SV* rv;
+ U32 cur;
+ U32 len;
+ IV iv;
+ NV nv;
+ MAGIC* magic;
+ HV* stash;
int sv_is_rv;
if (mt != SVt_PV && SvIsCOW(sv)) {
@@ -1828,55 +1827,40 @@
if (mt < SVt_PVIV)
(void)SvOOK_off(sv);
+ pv = NULL;
+ rv = NULL;
+ cur = 0;
+ len = 0;
+ iv = 0;
+ nv = 0.0;
+ magic = NULL;
+ stash = Nullhv;
+
switch (SvTYPE(sv)) {
case SVt_NULL:
- pv = 0;
- cur = 0;
- len = 0;
- iv = 0;
- nv = 0.0;
- magic = 0;
- stash = 0;
break;
case SVt_IV:
- pv = 0;
- cur = 0;
- len = 0;
iv = SvIVX(sv);
- nv = (NV)SvIVX(sv);
assert(SvANY(sv) == 0);
SvPMC_off(sv);
- magic = 0;
- stash = 0;
if (mt == SVt_NV)
mt = SVt_PVNV;
else if (mt < SVt_PVIV)
mt = SVt_PVIV;
break;
case SVt_NV:
- pv = 0;
- cur = 0;
- len = 0;
nv = SvNVX(sv);
- iv = I_V(nv);
magic = 0;
stash = 0;
assert(SvANY(sv) == 0);
SvPMC_off(sv);
- SvANY(sv) = 0;
if (mt < SVt_PVNV)
mt = SVt_PVNV;
break;
case SVt_RV:
rv = SvRV(sv);
- cur = 0;
- len = 0;
- iv = PTR2IV(rv);
- nv = PTR2NV(rv);
assert(SvANY(sv) == 0);
SvPMC_off(sv);
- magic = 0;
- stash = 0;
break;
case SVt_PV:
if (sv_is_rv) {
@@ -1886,10 +1870,6 @@
}
cur = SvCUR(sv);
len = SvLEN(sv);
- iv = 0;
- nv = 0.0;
- magic = 0;
- stash = 0;
del_XPV(SvANY(sv));
SvPMC_off(sv);
if (mt <= SVt_IV)
@@ -1906,9 +1886,6 @@
cur = SvCUR(sv);
len = SvLEN(sv);
iv = SvIVX(sv);
- nv = 0.0;
- magic = 0;
- stash = 0;
del_XPVIV(SvANY(sv));
SvPMC_off(sv);
break;
@@ -1922,8 +1899,6 @@
len = SvLEN(sv);
iv = SvIVX(sv);
nv = SvNVX(sv);
- magic = 0;
- stash = 0;
del_XPVNV(SvANY(sv));
SvPMC_off(sv);
break;