summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/util.c b/util.c
index 113cd179da..7583d23090 100644
--- a/util.c
+++ b/util.c
@@ -1457,8 +1457,10 @@ Perl_mess_sv(pTHX_ SV *basemsg, bool consume)
{
const bool line_mode = (RsSIMPLE(PL_rs) &&
SvCUR(PL_rs) == 1 && *SvPVX_const(PL_rs) == '\n');
- Perl_sv_catpvf(aTHX_ sv, ", <%s> %s %"IVdf,
- PL_last_in_gv == PL_argvgv ? "" : GvNAME(PL_last_in_gv),
+ Perl_sv_catpvf(aTHX_ sv, ", <%"SVf"> %s %"IVdf,
+ SVfARG(PL_last_in_gv == PL_argvgv
+ ? &PL_sv_no
+ : sv_2mortal(newSVhek(GvNAME_HEK(PL_last_in_gv)))),
line_mode ? "line" : "chunk",
(IV)IoLINES(GvIOp(PL_last_in_gv)));
}
@@ -3857,13 +3859,15 @@ void
Perl_report_wrongway_fh(pTHX_ const GV *gv, const char have)
{
if (ckWARN(WARN_IO)) {
- const char * const name
- = gv && (isGV(gv) || isGV_with_GP(gv)) ? GvENAME(gv) : NULL;
+ SV * const name
+ = gv && (isGV(gv) || isGV_with_GP(gv))
+ ? sv_2mortal(newSVhek(GvENAME_HEK((gv))))
+ : NULL;
const char * const direction = have == '>' ? "out" : "in";
- if (name && *name)
+ if (name && SvPOK(name) && *SvPV_nolen(name))
Perl_warner(aTHX_ packWARN(WARN_IO),
- "Filehandle %s opened only for %sput",
+ "Filehandle %"SVf" opened only for %sput",
name, direction);
else
Perl_warner(aTHX_ packWARN(WARN_IO),
@@ -3889,8 +3893,9 @@ Perl_report_evil_fh(pTHX_ const GV *gv)
}
if (ckWARN(warn_type)) {
- const char * const name
- = gv && (isGV(gv) || isGV_with_GP(gv)) ? GvENAME(gv) : NULL;
+ SV * const name
+ = gv && (isGV(gv) || isGV_with_GP(gv)) && GvENAMELEN(gv) ?
+ sv_2mortal(newSVhek(GvENAME_HEK(gv))) : NULL;
const char * const pars =
(const char *)(OP_IS_FILETEST(op) ? "" : "()");
const char * const func =
@@ -3902,14 +3907,14 @@ Perl_report_evil_fh(pTHX_ const GV *gv)
(const char *)
(OP_IS_SOCKET(op) || (io && IoTYPE(io) == IoTYPE_SOCKET)
? "socket" : "filehandle");
- if (name && *name) {
+ if (name && SvPOK(name) && *SvPV_nolen(name)) {
Perl_warner(aTHX_ packWARN(warn_type),
- "%s%s on %s %s %s", func, pars, vile, type, name);
+ "%s%s on %s %s %"SVf, func, pars, vile, type, SVfARG(name));
if (io && IoDIRP(io) && !(IoFLAGS(io) & IOf_FAKE_DIRP))
Perl_warner(
aTHX_ packWARN(warn_type),
- "\t(Are you trying to call %s%s on dirhandle %s?)\n",
- func, pars, name
+ "\t(Are you trying to call %s%s on dirhandle %"SVf"?)\n",
+ func, pars, SVfARG(name)
);
}
else {