X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=gv.c;h=418e08c7d276ef60d783faba5493c3e784af8329;hb=4df4e287246babaf287cf6336ca862ceeead8e46;hp=97c344809adbe6057a8a5239036b0c81408f2d56;hpb=5c1f4d79697c25c445705da5672c3103505b0d08;p=p5sagit%2Fp5-mst-13.2.git diff --git a/gv.c b/gv.c index 97c3448..418e08c 100644 --- a/gv.c +++ b/gv.c @@ -122,6 +122,25 @@ Perl_gv_fetchfile(pTHX_ const char *name) return gv; } +/* +=for apidoc gv_const_sv + +If C is a typeglob whose subroutine entry is a constant sub eligible for +inlining, or C is a placeholder reference that would be promoted to such +a typeglob, then returns the value returned by the sub. Otherwise, returns +NULL. + +=cut +*/ + +SV * +Perl_gv_const_sv(pTHX_ GV *gv) +{ + if (SvTYPE(gv) == SVt_PVGV) + return cv_const_sv(GvCVu(gv)); + return SvROK(gv) ? SvRV(gv) : NULL; +} + void Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) { @@ -722,7 +741,8 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, I32 len; register const char *namend; HV *stash = 0; - const I32 add = flags & ~SVf_UTF8; + const I32 no_init = flags & (GV_NOADD_NOINIT | GV_NOINIT); + const I32 add = flags & ~SVf_UTF8 & ~ GV_NOADD_NOINIT; PERL_UNUSED_ARG(full_len); @@ -887,7 +907,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, require_errno(gv); } return gv; - } else if (add & GV_NOINIT) { + } else if (no_init) { return gv; }