diff options
author | Nicholas Clark <nick@ccl4.org> | 2014-03-02 09:50:38 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2014-03-19 10:57:53 +0100 |
commit | d5eb9a4687ba974ffd0d02aab53326c5aba6a9e0 (patch) | |
tree | ac42edbd4daada8d4b122daa07c4700ad8169abd /doio.c | |
parent | 4b451737e0f77cc9e91b1336d04f21659d96b732 (diff) | |
download | perl-d5eb9a4687ba974ffd0d02aab53326c5aba6a9e0.tar.gz |
Change core uses of Perl_do_openn() to Perl_do_open6() or Perl_do_open_raw().
Calls to Perl_do_openn() all have at least 2 unused arguments which clutter
the code and hinder easy understanding. Perl_do_open6() and
Perl_do_open_raw() each only do one job, so don't have the dead arguments.
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -827,13 +827,16 @@ Perl_nextargv(pTHX_ GV *gv) return NULL; while (av_tindex(GvAV(gv)) >= 0) { STRLEN oldlen; + bool success; sv = av_shift(GvAV(gv)); SAVEFREESV(sv); SvTAINTED_off(GvSVn(gv)); /* previous tainting irrelevant */ sv_setsv(GvSVn(gv),sv); SvSETMAGIC(GvSV(gv)); PL_oldname = SvPVx(GvSV(gv), oldlen); - if (do_open(gv,PL_oldname,oldlen,PL_inplace!=0,O_RDONLY,0,NULL)) { + success = PL_inplace ? do_open_raw(gv, PL_oldname, oldlen, O_RDONLY, 0) + : do_open6(gv, PL_oldname, oldlen, NULL, NULL, 0); + if (success) { if (PL_inplace) { TAINT_PROPER("inplace open"); if (oldlen == 1 && *PL_oldname == '-') { @@ -900,7 +903,7 @@ Perl_nextargv(pTHX_ GV *gv) do_close(gv,FALSE); (void)PerlLIO_unlink(SvPVX_const(sv)); (void)PerlLIO_rename(PL_oldname,SvPVX_const(sv)); - do_open(gv,(char*)SvPVX_const(sv),SvCUR(sv),TRUE,O_RDONLY,0,NULL); + do_open_raw(gv, SvPVX_const(sv), SvCUR(sv), O_RDONLY, 0); #endif /* DOSISH */ #else (void)UNLINK(SvPVX_const(sv)); @@ -932,14 +935,14 @@ Perl_nextargv(pTHX_ GV *gv) sv_setpvn(sv,PL_oldname,oldlen); SETERRNO(0,0); /* in case sprintf set errno */ - if (!Perl_do_openn(aTHX_ PL_argvoutgv, (char*)SvPVX_const(sv), - SvCUR(sv), TRUE, + if (!Perl_do_open_raw(aTHX_ PL_argvoutgv, SvPVX_const(sv), + SvCUR(sv), #ifdef VMS - O_WRONLY|O_CREAT|O_TRUNC,0, + O_WRONLY|O_CREAT|O_TRUNC, 0 #else - O_WRONLY|O_CREAT|OPEN_EXCL,0600, + O_WRONLY|O_CREAT|OPEN_EXCL, 0600 #endif - NULL, NULL, 0)) { + )) { Perl_ck_warner_d(aTHX_ packWARN(WARN_INPLACE), "Can't do inplace edit on %s: %s", PL_oldname, Strerror(errno) ); do_close(gv,FALSE); @@ -2515,8 +2518,8 @@ Perl_vms_start_glob if (home && *home) SvSETMAGIC(*home); if (path && *path) SvSETMAGIC(*path); } - (void)do_open(PL_last_in_gv, (char*)SvPVX_const(tmpcmd), SvCUR(tmpcmd), - FALSE, O_RDONLY, 0, NULL); + (void)do_open6(PL_last_in_gv, SvPVX_const(tmpcmd), SvCUR(tmpcmd), + NULL, NULL, 0); fp = IoIFP(io); #endif /* !VMS */ LEAVE; |