diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-12 16:41:59 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-13 21:24:53 -0800 |
commit | 65d99836546f370bdc29ff2d99a22de1f5fc3bbf (patch) | |
tree | 271dd0e60f0042b8740d372a19c7e8f6bbe583b4 /util.c | |
parent | 8c85651df5beaed71753a27d7c04151c9a751875 (diff) | |
download | perl-65d99836546f370bdc29ff2d99a22de1f5fc3bbf.tar.gz |
Squash repetititive code in util.c:report_evil_fh
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 26 |
1 files changed, 9 insertions, 17 deletions
@@ -3908,26 +3908,18 @@ Perl_report_evil_fh(pTHX_ const GV *gv) (const char *) (OP_IS_SOCKET(op) || (io && IoTYPE(io) == IoTYPE_SOCKET) ? "socket" : "filehandle"); - if (name && SvPOK(name) && *SvPV_nolen(name)) { - Perl_warner(aTHX_ packWARN(warn_type), - "%s%s on %s %s %"SVf, func, pars, vile, type, SVfARG(name)); - if (io && IoDIRP(io) && !(IoFLAGS(io) & IOf_FAKE_DIRP)) + const bool have_name = name && SvPOK(name) && *SvPV_nolen(name); + Perl_warner(aTHX_ packWARN(warn_type), + "%s%s on %s %s%s%"SVf, func, pars, vile, type, + have_name ? " " : "", + SVfARG(have_name ? name : &PL_sv_no)); + 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 %"SVf"?)\n", - func, pars, SVfARG(name) + "\t(Are you trying to call %s%s on dirhandle%s%"SVf"?)\n", + func, pars, have_name ? " " : "", + SVfARG(have_name ? name : &PL_sv_no) ); - } - else { - Perl_warner(aTHX_ packWARN(warn_type), - "%s%s on %s %s", func, pars, vile, type); - 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?)\n", - func, pars - ); - } } } |