diff options
-rw-r--r-- | embed.fnc | 1 | ||||
-rw-r--r-- | embed.h | 2 | ||||
-rw-r--r-- | gv.c | 36 | ||||
-rw-r--r-- | proto.h | 3 | ||||
-rw-r--r-- | scope.c | 14 |
5 files changed, 30 insertions, 26 deletions
@@ -282,6 +282,7 @@ Ap |GV* |gv_fetchpv |NN const char* name|I32 add|I32 sv_type Ap |void |gv_fullname |NN SV* sv|NN const GV* gv Apmb |void |gv_fullname3 |NN SV* sv|NN const GV* gv|NULLOK const char* prefix Ap |void |gv_fullname4 |NN SV* sv|NN const GV* gv|NULLOK const char* prefix|bool keepmain +pMox |GP * |newGP |NN GV *const gv Ap |void |gv_init |NN GV* gv|NULLOK HV* stash|NN const char* name|STRLEN len|int multi Ap |void |gv_name_set |NN GV* gv|NN const char *name|U32 len|U32 flags Apd |HV* |gv_stashpv |NN const char* name|I32 create @@ -2430,6 +2430,8 @@ #define gv_fetchpv(a,b,c) Perl_gv_fetchpv(aTHX_ a,b,c) #define gv_fullname(a,b) Perl_gv_fullname(aTHX_ a,b) #define gv_fullname4(a,b,c,d) Perl_gv_fullname4(aTHX_ a,b,c,d) +#ifdef PERL_CORE +#endif #define gv_init(a,b,c,d,e) Perl_gv_init(aTHX_ a,b,c,d,e) #define gv_name_set(a,b,c,d) Perl_gv_name_set(aTHX_ a,b,c,d) #define gv_stashpv(a,b) Perl_gv_stashpv(aTHX_ a,b) @@ -157,11 +157,30 @@ Perl_gv_const_sv(pTHX_ GV *gv) return SvROK(gv) ? SvRV(gv) : NULL; } +GP * +Perl_newGP(pTHX_ GV *const gv) +{ + GP *gp; + Newxz(gp, 1, GP); + +#ifndef PERL_DONT_CREATE_GVSV + gp->gv_sv = newSV(0); +#endif + + gp->gp_line = CopLINE(PL_curcop); + /* XXX Ideally this cast would be replaced with a change to const char* + in the struct. */ + gp->gp_file = CopFILE(PL_curcop) ? CopFILE(PL_curcop) : (char *) ""; + gp->gp_egv = gv; + gp->gp_refcnt = 1; + + return gp; +} + void Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) { dVAR; - register GP *gp; const U32 old_type = SvTYPE(gv); const bool doproto = old_type > SVt_NULL; const char * const proto = (doproto && SvPOK(gv)) ? SvPVX_const(gv) : NULL; @@ -198,20 +217,9 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) } else Safefree(SvPVX_mutable(gv)); } - Newxz(gp, 1, GP); SvSCREAM_on(gv); - GvGP(gv) = gp_ref(gp); -#ifdef PERL_DONT_CREATE_GVSV - GvSV(gv) = NULL; -#else - GvSV(gv) = newSV(0); -#endif - GvLINE(gv) = CopLINE(PL_curcop); - /* XXX Ideally this cast would be replaced with a change to const char* - in the struct. */ - GvFILE(gv) = CopFILE(PL_curcop) ? CopFILE(PL_curcop) : (char *) ""; - GvCVGEN(gv) = 0; - GvEGV(gv) = gv; + + GvGP(gv) = Perl_newGP(aTHX_ gv); GvSTASH(gv) = stash; if (stash) Perl_sv_add_backref(aTHX_ (SV*)stash, (SV*)gv); @@ -645,6 +645,9 @@ PERL_CALLCONV void Perl_gv_fullname4(pTHX_ SV* sv, const GV* gv, const char* pre __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); +PERL_CALLCONV GP * Perl_newGP(pTHX_ GV *const gv) + __attribute__nonnull__(pTHX_1); + PERL_CALLCONV void Perl_gv_init(pTHX_ GV* gv, HV* stash, const char* name, STRLEN len, int multi) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); @@ -267,9 +267,7 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty) SSPUSHINT(SAVEt_GP); if (empty) { - register GP *gp; - - Newxz(gp, 1, GP); + GP *gp = Perl_newGP(aTHX_ gv); if (GvCVu(gv)) PL_sub_generation++; /* taking a method out of circulation */ @@ -277,15 +275,7 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty) gp->gp_io = newIO(); IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START; } - GvGP(gv) = gp_ref(gp); -#ifndef PERL_DONT_CREATE_GVSV - GvSV(gv) = newSV(0); -#endif - GvLINE(gv) = CopLINE(PL_curcop); - /* XXX Ideally this cast would be replaced with a change to const char* - in the struct. */ - GvFILE(gv) = CopFILE(PL_curcop) ? CopFILE(PL_curcop) : (char *) ""; - GvEGV(gv) = gv; + GvGP(gv) = gp; } else { gp_ref(GvGP(gv)); |