From: Nicholas Clark Date: Tue, 12 May 2009 22:48:01 +0000 (+0100) Subject: Inline S_glob_2pv() into Perl_sv_2pv_flags(). (Existing bugs included.) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8d1c3e263ba02c52927c03abb5de6a47cf4a89f8;p=p5sagit%2Fp5-mst-13.2.git Inline S_glob_2pv() into Perl_sv_2pv_flags(). (Existing bugs included.) Change 27942 missed this. (675c862fe1d4abfd048dce5f1958cca54b16c501) --- diff --git a/embed.fnc b/embed.fnc index 7dae763..6cda6ce 100644 --- a/embed.fnc +++ b/embed.fnc @@ -972,7 +972,6 @@ Apd |CV* |sv_2cv |NULLOK SV* sv|NN HV **const st|NN GV **const gvp \ Apd |IO* |sv_2io |NN SV *const sv #if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT) s |bool |glob_2number |NN GV* const gv -s |char* |glob_2pv |NN GV* const gv|NULLOK STRLEN * const len #endif Amb |IV |sv_2iv |NULLOK SV *sv Apd |IV |sv_2iv_flags |NULLOK SV *const sv|const I32 flags diff --git a/embed.h b/embed.h index 09af299..605cf22 100644 --- a/embed.h +++ b/embed.h @@ -864,7 +864,6 @@ #if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT) #ifdef PERL_CORE #define glob_2number S_glob_2number -#define glob_2pv S_glob_2pv #endif #endif #define sv_2iv_flags Perl_sv_2iv_flags @@ -3201,7 +3200,6 @@ #if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT) #ifdef PERL_CORE #define glob_2number(a) S_glob_2number(aTHX_ a) -#define glob_2pv(a,b) S_glob_2pv(aTHX_ a,b) #endif #endif #define sv_2iv_flags(a,b) Perl_sv_2iv_flags(aTHX_ a,b) diff --git a/proto.h b/proto.h index 520b6fa..8e177f0 100644 --- a/proto.h +++ b/proto.h @@ -3012,11 +3012,6 @@ STATIC bool S_glob_2number(pTHX_ GV* const gv) #define PERL_ARGS_ASSERT_GLOB_2NUMBER \ assert(gv) -STATIC char* S_glob_2pv(pTHX_ GV* const gv, STRLEN * const len) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_GLOB_2PV \ - assert(gv) - #endif /* PERL_CALLCONV IV Perl_sv_2iv(pTHX_ SV *sv); */ PERL_CALLCONV IV Perl_sv_2iv_flags(pTHX_ SV *const sv, const I32 flags); diff --git a/sv.c b/sv.c index 8c9b17a..858ba26 100644 --- a/sv.c +++ b/sv.c @@ -1859,27 +1859,6 @@ S_glob_2number(pTHX_ GV * const gv) return TRUE; } -STATIC char * -S_glob_2pv(pTHX_ GV * const gv, STRLEN * const len) -{ - const U32 wasfake = SvFLAGS(gv) & SVf_FAKE; - SV *const buffer = sv_newmortal(); - - PERL_ARGS_ASSERT_GLOB_2PV; - - /* FAKE globs can get coerced, so need to turn this off temporarily if it - is on. */ - SvFAKE_off(gv); - gv_efullname3(buffer, gv, "*"); - SvFLAGS(gv) |= wasfake; - - assert(SvPOK(buffer)); - if (len) { - *len = SvCUR(buffer); - } - return SvPVX(buffer); -} - /* Actually, ISO C leaves conversion of UV to IV undefined, but until proven guilty, assume that things are not that bad... */ @@ -2987,8 +2966,23 @@ Perl_sv_2pv_flags(pTHX_ register SV *const sv, STRLEN *const lp, const I32 flags #endif } else { - if (isGV_with_GP(sv)) - return glob_2pv(MUTABLE_GV(sv), lp); + if (isGV_with_GP(sv)) { + GV *const gv = MUTABLE_GV(sv); + const U32 wasfake = SvFLAGS(gv) & SVf_FAKE; + SV *const buffer = sv_newmortal(); + + /* FAKE globs can get coerced, so need to turn this off temporarily + if it is on. */ + SvFAKE_off(gv); + gv_efullname3(buffer, gv, "*"); + SvFLAGS(gv) |= wasfake; + + assert(SvPOK(buffer)); + if (lp) { + *lp = SvCUR(buffer); + } + return SvPVX(buffer); + } if (lp) *lp = 0;