Change 33742 by [EMAIL PROTECTED] on 2008/04/25 02:21:31
Integrate:
[ 32813]
Possible future bugs found by the creation of newSVpvn_flags().
But use newSVhek() in preference when possible.
[ 32815]
We can now sv_upgrade(sv, SVt_PVHV), so do so, to simplify the code.
Affected files ...
... //depot/maint-5.10/perl/mro.c#3 integrate
... //depot/maint-5.10/perl/perl.c#8 integrate
... //depot/maint-5.10/perl/pp.c#5 integrate
... //depot/maint-5.10/perl/regcomp.c#10 integrate
... //depot/maint-5.10/perl/sv.c#11 integrate
Differences ...
==== //depot/maint-5.10/perl/mro.c#3 (text) ====
Index: perl/mro.c
--- perl/mro.c#2~33139~ 2008-01-30 15:19:42.000000000 -0800
+++ perl/mro.c 2008-04-24 19:21:31.000000000 -0700
@@ -554,19 +554,12 @@
HE *he = hv_fetch_ent(PL_isarev, sv, TRUE, 0);
/* That fetch should not fail. But if it had to create a new SV for
- us, then we can detect it, because it will not be the correct type.
- Probably faster and cleaner for us to free that scalar [very little
- code actually executed to free it] and create a new HV than to
- copy&paste [SIN!] the code from newHV() to allow us to upgrade the
- new SV from SVt_NULL. */
+ us, then will need to upgrade it to an HV (which sv_upgrade() can
+ now do for us. */
mroisarev = (HV*)HeVAL(he);
- if(SvTYPE(mroisarev) != SVt_PVHV) {
- SvREFCNT_dec(mroisarev);
- mroisarev = newHV();
- HeVAL(he) = (SV *)mroisarev;
- }
+ SvUPGRADE((SV*)mroisarev, SVt_PVHV);
/* This hash only ever contains PL_sv_yes. Storing it over itself is
almost as cheap as calling hv_exists, so on aggregate we expect to
==== //depot/maint-5.10/perl/perl.c#8 (text) ====
Index: perl/perl.c
--- perl/perl.c#7~33614~ 2008-03-31 09:59:07.000000000 -0700
+++ perl/perl.c 2008-04-24 19:21:31.000000000 -0700
@@ -4971,7 +4971,8 @@
SvPOK() won't be true. */
assert(caret_X);
assert(SvPOKp(caret_X));
- prefix_sv = newSVpvn(SvPVX(caret_X), SvCUR(caret_X));
+ prefix_sv = newSVpvn_flags(SvPVX(caret_X), SvCUR(caret_X),
+ SvUTF8(caret_X));
/* Firstly take off the leading .../
If all else fail we'll do the paths relative to the current
directory. */
==== //depot/maint-5.10/perl/pp.c#5 (text) ====
Index: perl/pp.c
--- perl/pp.c#4~33149~ 2008-01-31 03:43:05.000000000 -0800
+++ perl/pp.c 2008-04-24 19:21:31.000000000 -0700
@@ -630,7 +630,7 @@
break;
case 'N':
if (strEQ(second_letter, "AME"))
- sv = newSVpvn(GvNAME(gv), GvNAMELEN(gv));
+ sv = newSVhek(GvNAME_HEK(gv));
break;
case 'P':
if (strEQ(second_letter, "ACKAGE")) {
==== //depot/maint-5.10/perl/regcomp.c#10 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#9~33590~ 2008-03-28 12:01:33.000000000 -0700
+++ perl/regcomp.c 2008-04-24 19:21:31.000000000 -0700
@@ -4992,9 +4992,7 @@
}
}
if (parno || flags & RXapif_ALL) {
- STRLEN len;
- char *pv = HePV(temphe, len);
- return newSVpvn(pv,len);
+ return newSVhek(HeKEY_hek(temphe));
}
}
}
@@ -5048,9 +5046,7 @@
}
}
if (parno || flags & RXapif_ALL) {
- STRLEN len;
- char *pv = HePV(temphe, len);
- av_push(av, newSVpvn(pv,len));
+ av_push(av, newSVhek(HeKEY_hek(temphe)));
}
}
}
==== //depot/maint-5.10/perl/sv.c#11 (text) ====
Index: perl/sv.c
--- perl/sv.c#10~33732~ 2008-04-22 12:53:49.000000000 -0700
+++ perl/sv.c 2008-04-24 19:21:31.000000000 -0700
@@ -11772,7 +11772,7 @@
return NULL;
if (HeKLEN(entry) == HEf_SVKEY)
return sv_mortalcopy(HeKEY_sv(entry));
- return sv_2mortal(newSVpvn(HeKEY(entry), HeKLEN(entry)));
+ return sv_2mortal(newSVhek(HeKEY_hek(entry)));
}
}
return NULL;
End of Patch.