In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a11eaecb3511133877ccbbc89337da7a30e8f21b?hp=562aee6bf50bd2244cded74c1addaf1f2a395cbd>
- Log ----------------------------------------------------------------- commit a11eaecb3511133877ccbbc89337da7a30e8f21b Author: Father Chrysostomos <[email protected]> Date: Sat Jul 28 18:32:02 2012 -0700 sv.h: Document SvTHINKFIRST M sv.h commit 153920a10f42560914e3260d6a282b2f08eddfa5 Author: Father Chrysostomos <[email protected]> Date: Sat Jul 28 00:39:41 2012 -0700 Dumper.xs: Avoid scan_vstring on 5.17.3 Now that vstring set-magic is gone (4499db7385), there is no PL_vtbl_vstring, so we cannot use it for detecting vstring bugginess. M dist/Data-Dumper/Dumper.xs commit 915268060395b06c8b4ca80ac2b7a4de7fc4bec0 Author: Father Chrysostomos <[email protected]> Date: Sat Jul 28 00:35:18 2012 -0700 Increase $Data::Dumper::VERSION to 2.135_07 M dist/Data-Dumper/Dumper.pm commit 8a68f32879ab48ea5a7fbacc6abdca4a65ec0d23 Author: Father Chrysostomos <[email protected]> Date: Sat Jul 28 00:33:33 2012 -0700 Oust sv_gmagical_2iv_please The magic flags patch prevents this from ever being called, since the OK flags work the same way for magic variables now as they have for muggle vars, avoid these fiddly games. (It was when writing it that I realised the value of the magic flags proposal.) M embed.fnc M embed.h M proto.h M sv.c M sv.h ----------------------------------------------------------------------- Summary of changes: dist/Data-Dumper/Dumper.pm | 4 ++-- dist/Data-Dumper/Dumper.xs | 2 +- embed.fnc | 1 - embed.h | 1 - proto.h | 5 ----- sv.c | 22 ---------------------- sv.h | 31 +++++++++++++++++++++++++------ 7 files changed, 28 insertions(+), 38 deletions(-) diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm index a099277..a5a6b31 100644 --- a/dist/Data-Dumper/Dumper.pm +++ b/dist/Data-Dumper/Dumper.pm @@ -10,7 +10,7 @@ package Data::Dumper; BEGIN { - $VERSION = '2.135_06'; # Don't forget to set version and release + $VERSION = '2.135_07'; # Don't forget to set version and release } # date in POD! #$| = 1; @@ -1332,7 +1332,7 @@ modify it under the same terms as Perl itself. =head1 VERSION -Version 2.135_06 (March 20 2012) +Version 2.135_07 (August 20 2012) =head1 SEE ALSO diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index 91e4c6c..f763664 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -1009,7 +1009,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, } #ifdef SvVOK else if (SvMAGICAL(val) && (mg = mg_find(val, 'V'))) { -# ifndef PL_vtbl_vstring +# ifndef PL_vtbl_vstring && PERL_VERSION < 17 SV * const vecsv = sv_newmortal(); # if PERL_VERSION < 10 scan_vstring(mg->mg_ptr, vecsv); diff --git a/embed.fnc b/embed.fnc index b3f757c..7968ece 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1319,7 +1319,6 @@ Apd |STRLEN |sv_len |NULLOK SV *const sv Apd |STRLEN |sv_len_utf8 |NULLOK SV *const sv Apd |void |sv_magic |NN SV *const sv|NULLOK SV *const obj|const int how \ |NULLOK const char *const name|const I32 namlen -pd |bool |sv_gmagical_2iv_please|NN SV *sv Apd |MAGIC *|sv_magicext |NN SV *const sv|NULLOK SV *const obj|const int how \ |NULLOK const MGVTBL *const vtbl|NULLOK const char *const name \ |const I32 namlen diff --git a/embed.h b/embed.h index 50d2344..aa950c4 100644 --- a/embed.h +++ b/embed.h @@ -1207,7 +1207,6 @@ #define sv_clean_objs() Perl_sv_clean_objs(aTHX) #define sv_del_backref(a,b) Perl_sv_del_backref(aTHX_ a,b) #define sv_free_arenas() Perl_sv_free_arenas(aTHX) -#define sv_gmagical_2iv_please(a) Perl_sv_gmagical_2iv_please(aTHX_ a) #define sv_ref(a,b,c) Perl_sv_ref(aTHX_ a,b,c) #define sv_sethek(a,b) Perl_sv_sethek(aTHX_ a,b) #ifndef PERL_IMPLICIT_CONTEXT diff --git a/proto.h b/proto.h index 3447f6c..2ecd0ec 100644 --- a/proto.h +++ b/proto.h @@ -3980,11 +3980,6 @@ PERL_CALLCONV char* Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 appen #define PERL_ARGS_ASSERT_SV_GETS \ assert(sv); assert(fp) -PERL_CALLCONV bool Perl_sv_gmagical_2iv_please(pTHX_ SV *sv) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_SV_GMAGICAL_2IV_PLEASE \ - assert(sv) - PERL_CALLCONV char* Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SV_GROW \ diff --git a/sv.c b/sv.c index b5950d6..1bccaae 100644 --- a/sv.c +++ b/sv.c @@ -2336,28 +2336,6 @@ Perl_sv_2iv_flags(pTHX_ register SV *const sv, const I32 flags) } /* -=for apidoc sv_gmagical_2iv_please - -Used internally by C<SvIV_please_nomg>, this function sets the C<SvIVX> -slot if C<sv_2iv> would have made the scalar C<SvIOK> had it not been -magical. In that case it returns true. - -=cut -*/ - -bool -Perl_sv_gmagical_2iv_please(pTHX_ register SV *sv) -{ - bool has_int; - PERL_ARGS_ASSERT_SV_GMAGICAL_2IV_PLEASE; - assert(SvGMAGICAL(sv) && !SvIOKp(sv) && (SvNOKp(sv) || SvPOKp(sv))); - if (S_sv_2iuv_common(aTHX_ sv)) { SvNIOK_off(sv); return 0; } - has_int = !!SvIOK(sv); - SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK); - return has_int; -} - -/* =for apidoc sv_2uv_flags Return the unsigned integer value of an SV, doing any necessary string diff --git a/sv.h b/sv.h index 4c58ee4..056d43b 100644 --- a/sv.h +++ b/sv.h @@ -962,6 +962,30 @@ the scalar's value cannot change unless written to. #define SvPCS_IMPORTED_on(sv) (SvFLAGS(sv) |= (SVf_ROK|SVprv_PCS_IMPORTED)) #define SvPCS_IMPORTED_off(sv) (SvFLAGS(sv) &= ~(SVf_ROK|SVprv_PCS_IMPORTED)) +/* +=for apidoc m|U32|SvTHINKFIRST|SV *sv + +A quick flag check to see whether an sv should be passed to sv_force_normal +to be "downgraded" before SvIVX or SvPVX can be modified directly. + +For example, if your scalar is a reference and you want to modify the SvIVX +slot, you can't just do SvROK_off, as that will leak the referent. + +This is used internally by various sv-modifying functions, such as +sv_setsv, sv_setiv and sv_pvn_force. + +One case that this does not handle is a gv without SvFAKE set. After + + if (SvTHINKFIRST(gv)) sv_force_normal(gv); + +it will still be a gv. + +SvTHINKFIRST sometimes produces false positives. In those cases +sv_force_normal does nothing. + +=cut +*/ + #define SvTHINKFIRST(sv) (SvFLAGS(sv) & SVf_THINKFIRST) #define SvPADMY(sv) (SvFLAGS(sv) & SVs_PADMY) @@ -1236,12 +1260,7 @@ the scalar's value cannot change unless written to. #define SvIV_please_nomg(sv) \ (!SvIOKp(sv) && (SvNOK(sv) || SvPOK(sv)) \ ? (SvIV_nomg(sv), SvIOK(sv)) \ - : SvGMAGICAL(sv) \ - ? SvIOKp(sv) || ( \ - (SvNOKp(sv) || SvPOKp(sv)) \ - && sv_gmagical_2iv_please(sv) \ - ) \ - : SvIOK(sv)) + : SvIOK(sv)) #define SvIV_set(sv, val) \ STMT_START { \ assert(PL_valid_types_IV_set[SvTYPE(sv) & SVt_MASK]); \ -- Perl5 Master Repository
