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
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|NULLOK const char *name|U32 len|U32 flags
Apd |HV* |gv_stashpv |NN const char* name|I32 create
Apd |HV* |gv_stashpvn |NN const char* name|U32 namelen|I32 create
Apd |HV* |gv_stashsv |NULLOK SV* sv|I32 create
#define gv_fullname Perl_gv_fullname
#define gv_fullname4 Perl_gv_fullname4
#define gv_init Perl_gv_init
+#define gv_name_set Perl_gv_name_set
#define gv_stashpv Perl_gv_stashpv
#define gv_stashpvn Perl_gv_stashpvn
#define gv_stashsv Perl_gv_stashsv
#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)
#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)
#define gv_stashpvn(a,b,c) Perl_gv_stashpvn(aTHX_ a,b,c)
#define gv_stashsv(a,b) Perl_gv_stashsv(aTHX_ a,b)
Perl_gv_fullname3
Perl_gv_fullname4
Perl_gv_init
+Perl_gv_name_set
Perl_gv_stashpv
Perl_gv_stashpvn
Perl_gv_stashsv
GvSTASH(gv) = stash;
if (stash)
Perl_sv_add_backref(aTHX_ (SV*)stash, (SV*)gv);
- GvNAME(gv) = savepvn(name, len);
- GvNAMELEN(gv) = len;
+ gv_name_set(gv, name, len, 0);
if (multi || doproto) /* doproto means it _was_ mentioned */
GvMULTI_on(gv);
if (doproto) { /* Replicate part of newSUB here. */
return FALSE;
}
+void
+Perl_gv_name_set(pTHX_ GV *gv, const char *name, U32 len, U32 flags)
+{
+ dVAR;
+
+ PERL_UNUSED_ARG(flags);
+
+ GvXPVGV(gv)->xgv_name = name ? savepvn(name, len) : NULL;
+ GvXPVGV(gv)->xgv_namelen = len;
+}
+
/*
* Local variables:
* c-indentation-style: bsd
assert(SvTYPE(_gv) == SVt_PVGV || SvTYPE(_gv) >= SVt_PVLV); \
&(GvXPVGV(_gv)->xnv_u.xgv_stash); \
}))
-# define GvNAME(gv) \
- (*({ GV * const zzzz = (GV *) (gv); \
- assert(isGV_with_GP(zzzz)); \
- assert(SvTYPE(zzzz) == SVt_PVGV || SvTYPE(zzzz) >= SVt_PVLV); \
- &(GvXPVGV(zzzz)->xgv_name); \
- }))
-# define GvNAMELEN(gv) \
- (*({ GV * const glank = (GV *) (gv); \
- assert(isGV_with_GP(glank)); \
- assert(SvTYPE(glank) == SVt_PVGV || SvTYPE(glank) >= SVt_PVLV); \
- &(GvXPVGV(glank)->xgv_namelen); \
- }))
+# define GvNAME_get(gv) \
+ ({ GV * const zzzz = (GV *) (gv); \
+ assert(isGV_with_GP(zzzz)); \
+ assert(SvTYPE(zzzz) == SVt_PVGV || SvTYPE(zzzz) >= SVt_PVLV); \
+ 0 + (GvXPVGV(zzzz)->xgv_name); \
+ })
+# define GvNAMELEN_get(gv) \
+ ({ GV * const glank = (GV *) (gv); \
+ assert(isGV_with_GP(glank)); \
+ assert(SvTYPE(glank) == SVt_PVGV || SvTYPE(glank) >= SVt_PVLV); \
+ 0 + (GvXPVGV(glank)->xgv_namelen); \
+ })
#else
# define GvGP(gv) ((gv)->sv_u.svu_gp)
# define GvFLAGS(gv) (GvXPVGV(gv)->xpv_cur)
# define GvSTASH(gv) (GvXPVGV(gv)->xnv_u.xgv_stash)
-# define GvNAME(gv) (GvXPVGV(gv)->xgv_name)
-# define GvNAMELEN(gv) (GvXPVGV(gv)->xgv_namelen)
+# define GvNAME_get(gv) (0 + GvXPVGV(gv)->xgv_name)
+# define GvNAMELEN_get(gv) (0 + GvXPVGV(gv)->xgv_namelen)
#endif
+#define GvNAME(gv) GvNAME_get(gv)
+#define GvNAMELEN(gv) GvNAMELEN_get(gv)
+
#define GvASSIGN_GENERATION(gv) (0 + ((XPV*) SvANY(gv))->xpv_len)
#define GvASSIGN_GENERATION_set(gv,val) \
STMT_START { assert(SvTYPE(gv) == SVt_PVGV); \
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_3);
+PERL_CALLCONV void Perl_gv_name_set(pTHX_ GV* gv, const char *name, U32 len, U32 flags)
+ __attribute__nonnull__(pTHX_1);
+
PERL_CALLCONV HV* Perl_gv_stashpv(pTHX_ const char* name, I32 create)
__attribute__nonnull__(pTHX_1);
GvSTASH(dstr) = GvSTASH(sstr);
if (GvSTASH(dstr))
Perl_sv_add_backref(aTHX_ (SV*)GvSTASH(dstr), dstr);
- GvNAME(dstr) = savepvn(name, len);
- GvNAMELEN(dstr) = len;
+ gv_name_set(dstr, name, len, 0);
SvFAKE_on(dstr); /* can coerce to non-glob */
}
LvTARG(dstr) = sv_dup_inc(LvTARG(dstr), param);
break;
case SVt_PVGV:
- GvNAME(dstr) = SAVEPVN(GvNAME(dstr), GvNAMELEN(dstr));
+ GvXPVGV(dstr)->xgv_name = SAVEPVN(GvNAME(dstr), GvNAMELEN(dstr));
+
/* Don't call sv_add_backref here as it's going to be created
as part of the magic cloning of the symbol table. */
GvSTASH(dstr) = hv_dup(GvSTASH(dstr), param);