This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use PL_{argv,stdin,stdout}gv to avoid unnecessary gv_fetch calls.
authorChip Salzenberg <chip@pobox.com>
Mon, 24 Feb 2003 14:54:36 +0000 (14:54 +0000)
committerchip <chip@pobox.com>
Mon, 24 Feb 2003 14:54:36 +0000 (14:54 +0000)
p4raw-id: //depot/perl@18763

op.c
win32/perlhost.h

diff --git a/op.c b/op.c
index 0cc8c33..fd853ae 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4692,8 +4692,7 @@ Perl_ck_eof(pTHX_ OP *o)
     if (o->op_flags & OPf_KIDS) {
        if (cLISTOPo->op_first->op_type == OP_STUB) {
            op_free(o);
-           o = newUNOP(type, OPf_SPECIAL,
-               newGVOP(OP_GV, 0, gv_fetchpv("main::ARGV", TRUE, SVt_PVAV)));
+           o = newUNOP(type, OPf_SPECIAL, newGVOP(OP_GV, 0, PL_argvgv));
        }
        return ck_fun(o);
     }
@@ -4930,8 +4929,7 @@ Perl_ck_ftst(pTHX_ OP *o)
     else {
        op_free(o);
        if (type == OP_FTTTY)
-           o =  newGVOP(type, OPf_REF, gv_fetchpv("main::STDIN", TRUE,
-                               SVt_PVIO));
+           o = newGVOP(type, OPf_REF, PL_stdingv);
        else
            o = newUNOP(type, 0, newDEFSVOP());
     }
@@ -5564,8 +5562,7 @@ Perl_ck_shift(pTHX_ OP *o)
 
        op_free(o);
        argop = newUNOP(OP_RV2AV, 0,
-           scalar(newGVOP(OP_GV, 0, !CvUNIQUE(PL_compcv) ?
-                          PL_defgv : gv_fetchpv("ARGV", TRUE, SVt_PVAV))));
+           scalar(newGVOP(OP_GV, 0, CvUNIQUE(PL_compcv) ? PL_argvgv : PL_defgv)));
        return newUNOP(type, 0, scalar(argop));
     }
     return scalar(modkids(ck_fun(o), type));
index b68f5c7..371a3a5 100644 (file)
@@ -1774,9 +1774,9 @@ restart:
     win32_checkTLS(my_perl);
     /* close the std handles to avoid fd leaks */
     {
-       do_close(gv_fetchpv("STDIN", TRUE, SVt_PVIO), FALSE);
-       do_close(gv_fetchpv("STDOUT", TRUE, SVt_PVIO), FALSE);
-       do_close(gv_fetchpv("STDERR", TRUE, SVt_PVIO), FALSE);
+       do_close(PL_stdingv, FALSE);
+       do_close(gv_fetchpv("STDOUT", TRUE, SVt_PVIO), FALSE); /* PL_stdoutgv - ISAGN */
+       do_close(PL_stderrgv, FALSE);
     }
 
     /* destroy everything (waits for any pseudo-forked children) */