From: Nicholas Clark Date: Thu, 20 Dec 2007 17:47:48 +0000 (+0000) Subject: Perl_magic_setglob() is a mathom. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=56d7a0868d14c11c08f61a0acccc9ee745b4e081;p=p5sagit%2Fp5-mst-13.2.git Perl_magic_setglob() is a mathom. p4raw-id: //depot/perl@32672 --- diff --git a/embed.fnc b/embed.fnc index 2211eb6..4f7254b 100644 --- a/embed.fnc +++ b/embed.fnc @@ -462,7 +462,9 @@ p |int |magic_setenv |NN SV* sv|NN MAGIC* mg p |int |magic_setfm |NN SV* sv|NN MAGIC* mg dp |int |magic_sethint |NN SV* sv|NN MAGIC* mg p |int |magic_setisa |NN SV* sv|NN MAGIC* mg +#ifndef NO_MATHOMS p |int |magic_setglob |NN SV* sv|NN MAGIC* mg +#endif p |int |magic_setmglob |NN SV* sv|NN MAGIC* mg p |int |magic_setnkeys |NN SV* sv|NN MAGIC* mg p |int |magic_setpack |NN SV* sv|NN MAGIC* mg diff --git a/embed.h b/embed.h index deb30b3..fd21f57 100644 --- a/embed.h +++ b/embed.h @@ -433,7 +433,13 @@ #define magic_setfm Perl_magic_setfm #define magic_sethint Perl_magic_sethint #define magic_setisa Perl_magic_setisa +#endif +#ifndef NO_MATHOMS +#ifdef PERL_CORE #define magic_setglob Perl_magic_setglob +#endif +#endif +#ifdef PERL_CORE #define magic_setmglob Perl_magic_setmglob #define magic_setnkeys Perl_magic_setnkeys #define magic_setpack Perl_magic_setpack @@ -2722,7 +2728,13 @@ #define magic_setfm(a,b) Perl_magic_setfm(aTHX_ a,b) #define magic_sethint(a,b) Perl_magic_sethint(aTHX_ a,b) #define magic_setisa(a,b) Perl_magic_setisa(aTHX_ a,b) +#endif +#ifndef NO_MATHOMS +#ifdef PERL_CORE #define magic_setglob(a,b) Perl_magic_setglob(aTHX_ a,b) +#endif +#endif +#ifdef PERL_CORE #define magic_setmglob(a,b) Perl_magic_setmglob(aTHX_ a,b) #define magic_setnkeys(a,b) Perl_magic_setnkeys(aTHX_ a,b) #define magic_setpack(a,b) Perl_magic_setpack(aTHX_ a,b) diff --git a/mathoms.c b/mathoms.c index cccaa92..59ffe09 100644 --- a/mathoms.c +++ b/mathoms.c @@ -65,6 +65,7 @@ PERL_CALLCONV void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len); PERL_CALLCONV void Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len); PERL_CALLCONV int Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...); PERL_CALLCONV int Perl_printf_nocontext(const char *format, ...); +PERL_CALLCONV int Perl_magic_setglob(pTHX_ SV* sv, MAGIC* mg); /* ref() is now a macro using Perl_doref; @@ -1315,6 +1316,18 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen_i32, I32 flags) NULL, 0); } +/* Functions after here were made mathoms post 5.10.0 but pre 5.8.9 */ +int +Perl_magic_setglob(pTHX_ SV *sv, MAGIC *mg) +{ + PERL_UNUSED_ARG(mg); + PERL_UNUSED_ARG(sv); + + Perl_croak(aTHX_ "Perl_magic_setglob is dead code?"); + + return 0; +} + #endif /* NO_MATHOMS */ /* diff --git a/mg.c b/mg.c index c4d7aeb..4a6c689 100644 --- a/mg.c +++ b/mg.c @@ -1928,30 +1928,6 @@ Perl_magic_setpos(pTHX_ SV *sv, MAGIC *mg) } int -Perl_magic_setglob(pTHX_ SV *sv, MAGIC *mg) -{ - GV* gv; - PERL_UNUSED_ARG(mg); - - Perl_croak(aTHX_ "Perl_magic_setglob is dead code?"); - - if (!SvOK(sv)) - return 0; - if (isGV_with_GP(sv)) { - /* We're actually already a typeglob, so don't need the stuff below. - */ - return 0; - } - gv = gv_fetchsv(sv, GV_ADD, SVt_PVGV); - if (sv == (SV*)gv) - return 0; - if (GvGP(sv)) - gp_free((GV*)sv); - GvGP(sv) = gp_ref(GvGP(gv)); - return 0; -} - -int Perl_magic_getsubstr(pTHX_ SV *sv, MAGIC *mg) { STRLEN len; diff --git a/proto.h b/proto.h index a302ec4..cdf0ecd 100644 --- a/proto.h +++ b/proto.h @@ -1218,10 +1218,12 @@ PERL_CALLCONV int Perl_magic_setisa(pTHX_ SV* sv, MAGIC* mg) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); +#ifndef NO_MATHOMS PERL_CALLCONV int Perl_magic_setglob(pTHX_ SV* sv, MAGIC* mg) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); +#endif PERL_CALLCONV int Perl_magic_setmglob(pTHX_ SV* sv, MAGIC* mg) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2);