From 8a68f32879ab48ea5a7fbacc6abdca4a65ec0d23 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 28 Jul 2012 00:33:33 -0700 Subject: 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.) --- embed.fnc | 1 - embed.h | 1 - proto.h | 5 ----- sv.c | 22 ---------------------- sv.h | 7 +------ 5 files changed, 1 insertion(+), 35 deletions(-) diff --git a/embed.fnc b/embed.fnc index b3f757c1bf..7968ece904 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 50d2344bed..aa950c414c 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 3447f6c0ed..2ecd0ec2a2 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 b5950d65f0..1bccaae75a 100644 --- a/sv.c +++ b/sv.c @@ -2335,28 +2335,6 @@ Perl_sv_2iv_flags(pTHX_ register SV *const sv, const I32 flags) return SvIsUV(sv) ? (IV)SvUVX(sv) : SvIVX(sv); } -/* -=for apidoc sv_gmagical_2iv_please - -Used internally by C, this function sets the C -slot if C would have made the scalar C 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 diff --git a/sv.h b/sv.h index 4c58ee4354..06b214cb25 100644 --- 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]); \ -- cgit v1.2.1