Apd |CV* |sv_2cv |NULLOK SV* sv|NN HV** st|NN GV** gvp|I32 lref
Apd |IO* |sv_2io |NN SV* sv
#ifdef PERL_IN_SV_C
-s |char* |glob_2inpuv |NN GV* gv|NULLOK STRLEN *len|bool want_number
+s |char* |glob_2inpuv_number|NN GV* const gv
+s |char* |glob_2inpuv |NN GV* const gv|NN STRLEN * const len
#endif
Amb |IV |sv_2iv |NN SV* sv
Apd |IV |sv_2iv_flags |NN SV* sv|I32 flags
#define sv_2io Perl_sv_2io
#ifdef PERL_IN_SV_C
#ifdef PERL_CORE
+#define glob_2inpuv_number S_glob_2inpuv_number
#define glob_2inpuv S_glob_2inpuv
#endif
#endif
#define sv_2io(a) Perl_sv_2io(aTHX_ a)
#ifdef PERL_IN_SV_C
#ifdef PERL_CORE
-#define glob_2inpuv(a,b,c) S_glob_2inpuv(aTHX_ a,b,c)
+#define glob_2inpuv_number(a) S_glob_2inpuv_number(aTHX_ a)
+#define glob_2inpuv(a,b) S_glob_2inpuv(aTHX_ a,b)
#endif
#endif
#define sv_2iv_flags(a,b) Perl_sv_2iv_flags(aTHX_ a,b)
__attribute__nonnull__(pTHX_1);
#ifdef PERL_IN_SV_C
-STATIC char* S_glob_2inpuv(pTHX_ GV* gv, STRLEN *len, bool want_number)
+STATIC char* S_glob_2inpuv_number(pTHX_ GV* const gv)
__attribute__nonnull__(pTHX_1);
+STATIC char* S_glob_2inpuv(pTHX_ GV* const gv, STRLEN * const len)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+
#endif
/* PERL_CALLCONV IV sv_2iv(pTHX_ SV* sv)
__attribute__nonnull__(pTHX_1); */
}
STATIC char *
-S_glob_2inpuv(pTHX_ GV *gv, STRLEN *len, bool want_number)
+S_glob_2inpuv_number(pTHX_ GV * const gv)
{
const U32 wasfake = SvFLAGS(gv) & SVf_FAKE;
SV *const buffer = sv_newmortal();
gv_efullname3(buffer, gv, "*");
SvFLAGS(gv) |= wasfake;
- if (want_number) {
- /* We know that all GVs stringify to something that is not-a-number,
- so no need to test that. */
- if (ckWARN(WARN_NUMERIC))
- not_a_number(buffer);
- /* We just want something true to return, so that S_sv_2iuv_common
- can tail call us and return true. */
- return (char *) 1;
- } else {
- assert(SvPOK(buffer));
- if (len) {
- *len = SvCUR(buffer);
- }
- return SvPVX(buffer);
- }
+ /* We know that all GVs stringify to something that is not-a-number,
+ so no need to test that. */
+ if (ckWARN(WARN_NUMERIC))
+ not_a_number(buffer);
+ /* We just want something true to return, so that S_sv_2iuv_common
+ can tail call us and return true. */
+ return (char *) 1;
+}
+
+STATIC char *
+S_glob_2inpuv(pTHX_ GV * const gv, STRLEN * const len)
+{
+ 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));
+ *len = SvCUR(buffer);
+ return SvPVX(buffer);
}
/* Actually, ISO C leaves conversion of UV to IV undefined, but
}
}
else {
- if (isGV_with_GP(sv)) {
- return (bool)PTR2IV(glob_2inpuv((GV *)sv, NULL, TRUE));
- }
+ if (isGV_with_GP(sv))
+ return (bool)PTR2IV(glob_2inpuv_number((GV *)sv));
if (!(SvFLAGS(sv) & SVs_PADTMP)) {
if (!PL_localizing && ckWARN(WARN_UNINITIALIZED))
}
else {
if (isGV_with_GP(sv)) {
- glob_2inpuv((GV *)sv, NULL, TRUE);
+ glob_2inpuv_number((GV *)sv);
return 0.0;
}
#endif
}
else {
- if (isGV_with_GP(sv)) {
- return glob_2inpuv((GV *)sv, lp, FALSE);
- }
+ if (isGV_with_GP(sv))
+ return glob_2inpuv((GV *)sv, lp);
if (!PL_localizing && !(SvFLAGS(sv) & SVs_PADTMP) && ckWARN(WARN_UNINITIALIZED))
report_uninit(sv);