This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Oust sv_gmagical_2iv_please
authorFather Chrysostomos <sprout@cpan.org>
Sat, 28 Jul 2012 07:33:33 +0000 (00:33 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 29 Jul 2012 05:20:04 +0000 (22:20 -0700)
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.)

embed.fnc
embed.h
proto.h
sv.c
sv.h

index b3f757c..7968ece 100644 (file)
--- 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 (file)
--- a/embed.h
+++ b/embed.h
 #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 (file)
--- 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 (file)
--- 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..06b214c 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -1236,12 +1236,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]);   \