summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-01-02 20:56:21 +0000
committerNicholas Clark <nick@ccl4.org>2011-01-02 20:56:21 +0000
commit9c9f25b8ce09796ec5e5e4e5c76f43506c223a8f (patch)
tree0a350bd0d84bb3068db4da380354fca0ac235de4 /pp_hot.c
parent9426e1a55981168c83a030df9bce5e0b46586581 (diff)
downloadperl-9c9f25b8ce09796ec5e5e4e5c76f43506c223a8f.tar.gz
GvIO(gv) returns NULL for a NULL gv, so refactor to take advantage of this.
Simplify tests of !gv || !io to just !io, avoid calling GvIO(gv) more than once, and where possible initialise io at declaration time, to allow it to be const.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 67e2d804b7..be0e3f4a07 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -710,13 +710,13 @@ PP(pp_pushre)
PP(pp_print)
{
dVAR; dSP; dMARK; dORIGMARK;
- IO *io;
register PerlIO *fp;
MAGIC *mg;
GV * const gv
= (PL_op->op_flags & OPf_STACKED) ? MUTABLE_GV(*++MARK) : PL_defoutgv;
+ IO *io = GvIO(gv);
- if (gv && (io = GvIO(gv))
+ if (io
&& (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar)))
{
had_magic:
@@ -746,7 +746,7 @@ PP(pp_print)
SP = MARK;
RETURN;
}
- if (!(io = GvIO(gv))) {
+ if (!io) {
if ( gv && GvEGVx(gv) && (io = GvIO(GvEGV(gv)))
&& (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar)))
goto had_magic;