diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-12-28 09:50:49 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-12-28 10:04:09 +0000 |
commit | 51087808ceed79175a75ce3a398a755b78f57a75 (patch) | |
tree | 8c7a4646269e7dcc18f10dca6b4a0136c153785f /pp_hot.c | |
parent | 7716c5c554409ba94e8dd56116adbde29e4d5b6c (diff) | |
download | perl-51087808ceed79175a75ce3a398a755b78f57a75.tar.gz |
As report_evil_fh() checks WARN_{CLOSED,UNOPENED}, don't duplicate this.
This trades reduced code size for an extra function call in the error path with
warnings disabled. (And removes a duplicated check for the case of taking the
error path *with* warnings enabled.)
Removing the check from Perl_do_close() does not change behaviour, as io is
NULL there, hence Perl_report_evil_fh() will always be checking WARN_UNOPENED
and setting vile to "unopened".
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -750,15 +750,14 @@ PP(pp_print) if ( gv && GvEGVx(gv) && (io = GvIO(GvEGV(gv))) && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) goto had_magic; - if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) - report_evil_fh(gv); + report_evil_fh(gv); SETERRNO(EBADF,RMS_IFI); goto just_say_no; } else if (!(fp = IoOFP(io))) { if (IoIFP(io)) report_wrongway_fh(gv, '<'); - else if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) + else report_evil_fh(gv); SETERRNO(EBADF,IoIFP(io)?RMS_FAC:RMS_IFI); goto just_say_no; |