From: Chip Salzenberg Date: Mon, 24 Feb 2003 14:54:36 +0000 (+0000) Subject: Use PL_{argv,stdin,stdout}gv to avoid unnecessary gv_fetch calls. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8fde6460a7cb90e344d87e1652b5fa8d61c68699;p=p5sagit%2Fp5-mst-13.2.git Use PL_{argv,stdin,stdout}gv to avoid unnecessary gv_fetch calls. p4raw-id: //depot/perl@18763 --- diff --git a/op.c b/op.c index 0cc8c33..fd853ae 100644 --- 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)); diff --git a/win32/perlhost.h b/win32/perlhost.h index b68f5c7..371a3a5 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -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) */