diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-10-01 19:29:50 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-10-01 19:29:50 +0000 |
commit | f0a78170a1cd45c5019f6c77288041aa0767e0ff (patch) | |
tree | d74d0904fb4521767ac7e7a1616a1636dbb3ae6a /pp_sys.c | |
parent | 135a59c2f92f027eb9590c57b576fc883a7d53aa (diff) | |
download | perl-f0a78170a1cd45c5019f6c77288041aa0767e0ff.tar.gz |
In pp_binmode, call mode_from_discipline() once and remember the result.
p4raw-id: //depot/perl@28910
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -766,22 +766,23 @@ PP(pp_binmode) } PUTBACK; - if (PerlIO_binmode(aTHX_ fp,IoTYPE(io),mode_from_discipline(discp), - (discp) ? SvPV_nolen_const(discp) : NULL)) { - if (IoOFP(io) && IoOFP(io) != IoIFP(io)) { - if (!PerlIO_binmode(aTHX_ IoOFP(io),IoTYPE(io), - mode_from_discipline(discp), - (discp) ? SvPV_nolen_const(discp) : NULL)) { - SPAGAIN; - RETPUSHUNDEF; - } + { + const int mode = mode_from_discipline(discp); + const char *const d = (discp ? SvPV_nolen_const(discp) : NULL); + if (PerlIO_binmode(aTHX_ fp, IoTYPE(io), mode, d)) { + if (IoOFP(io) && IoOFP(io) != IoIFP(io)) { + if (!PerlIO_binmode(aTHX_ IoOFP(io), IoTYPE(io), mode, d)) { + SPAGAIN; + RETPUSHUNDEF; + } + } + SPAGAIN; + RETPUSHYES; + } + else { + SPAGAIN; + RETPUSHUNDEF; } - SPAGAIN; - RETPUSHYES; - } - else { - SPAGAIN; - RETPUSHUNDEF; } } |