In perl.git, the branch smoke-me/nicholas/openn has been created
<http://perl5.git.perl.org/perl.git/commitdiff/22d0f40bbb3d38937ff93ec111b4d026d22e4962?hp=0000000000000000000000000000000000000000>
at 22d0f40bbb3d38937ff93ec111b4d026d22e4962 (commit)
- Log -----------------------------------------------------------------
commit 22d0f40bbb3d38937ff93ec111b4d026d22e4962
Author: Nicholas Clark <[email protected]>
Date: Sun Mar 2 10:12:08 2014 +0100
In Perl_nextargv(), move variable declarations into the blocks that use
them.
This makes it clearer that variables don't hold values between iterations of
the loop, and permits the variable sv to be made const.
M doio.c
commit 504b3a599e8c77b8133422d21e3420f4d396a41e
Author: Nicholas Clark <[email protected]>
Date: Sun Mar 2 10:02:51 2014 +0100
Simplify the code in Perl_nextargv().
Split the ternary that called Perl_do_open_raw() and Perl_do_open6() based
on PL_inplace into two different if blocks, and merge these with the
following
code which is also conditional on PL_inplace.
Remove the warning code from an else block and re-indent it, to make it
clear
that it is always called if control reaches the end of the while loop.
M doio.c
commit 0a0cb33d69ea6327f32f2bd2352ee6cc2f2282ca
Author: Nicholas Clark <[email protected]>
Date: Sun Mar 2 09:50:38 2014 +0100
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.
M doio.c
M os2/os2.c
M pp_hot.c
M pp_sys.c
commit 18ebb48cbb1e8cce436b6883b319458b64b83168
Author: Nicholas Clark <[email protected]>
Date: Sun Mar 2 09:26:29 2014 +0100
Split Perl_do_openn() into Perl_do_open_raw() and Perl_do_open6().
Perl_do_open_raw() handles the as_raw part of Perl_do_openn().
Perl_do_open6() handles the !as_raw part of Perl_do_openn().
do_open6() isn't a great name, but I can't see an obvious concise name that
covers 2 arg open, 3 arg open, piped open, implicit fork, and layers.
M doio.c
M embed.fnc
M embed.h
M proto.h
commit c8cbc9e3399d5c87729ac50d3f9f145d6af0c887
Author: Nicholas Clark <[email protected]>
Date: Sun Mar 2 08:14:13 2014 +0100
Extract the cleanup code of Perl_do_openn() into S_openn_cleanup().
A 12 parameter function is extremely ugly (as demonstrated by the need to
add
macros for it to perl.h), but it's private, and it will permit the
two-headed
public interface of Perl_do_openn() to be simplified.
M doio.c
M embed.fnc
M embed.h
M perl.h
M proto.h
commit df1b1cfadd95377236ecd457ab9cb353cdb5836f
Author: Nicholas Clark <[email protected]>
Date: Sun Mar 2 07:38:00 2014 +0100
Extract the setup code of Perl_do_openn() into S_openn_setup().
M doio.c
M embed.fnc
M embed.h
M proto.h
commit 1d8a4943e87eb7cb5570240f10bb741173c5c2cb
Author: Nicholas Clark <[email protected]>
Date: Sat Mar 1 22:53:52 2014 +0100
In Perl_do_openn(), disambiguate the two separate uses of the variable fd.
Rename the first uses of the variable fd to wanted_fd to show that the
variable is not used to pass a value to later in the function.
M doio.c
commit 061212bf76f284cdddb59a6faf1f18d6186c1fb0
Author: Nicholas Clark <[email protected]>
Date: Sat Mar 1 22:38:18 2014 +0100
In Perl_do_openn(), move the variable result into the block that uses it.
This also removes a couple of places which would set result = 0 to simulate
"success" for an a later if block. Those paths now don't even reach that
if block.
M doio.c
commit b408984328c052cdc7ea40294c072afa11d0e669
Author: Nicholas Clark <[email protected]>
Date: Sat Mar 1 21:32:19 2014 +0100
Perl_do_openn() doesn't need to set num_svs and svp.
These variables are no longer used later in the function, so no need to set
them. This permits the declaration of the variable namesv to be moved from
the top of the function into the blocks that use it.
M doio.c
commit 716f09258654910fab7604c6795ed657b25018d5
Author: Nicholas Clark <[email protected]>
Date: Sat Mar 1 21:10:38 2014 +0100
Perl_do_openn() should call PerlIO_openn() with arg NULL if narg is 0.
If narg is NULL, then PerlIO_openn() doesn't look at args.
(Technically except for PerlIOStdio_open() if f is non-NULL, which doesn't
check narg and assumes that args[0] is valid. That lack of check is probably
a bug. But it doesn't matter in this case, as f is NULL)
This makes it clear that arg isn't needed at this point in Perl_do_openn().
This is a more complete version of the change made by commit
dd37d22f759197ae
(March 2002), which just changed the call to pass 0 for narg.
M doio.c
commit 7abadd94a1de1f57776b76d1dfe7863f26b8306a
Author: Nicholas Clark <[email protected]>
Date: Sat Mar 1 22:00:29 2014 +0100
In Perl_do_openn(), move {in,out}_{raw,crlf} into the !as_raw block.
These 4 variables are only needed there, so by moving them into the block we
save doing unneeded work for the as_raw case (ie sysopen), and as a side
effect make the function a bit clearer.
M doio.c
commit f18aeaaf2792b700024b7b809e862d77191a71b3
Author: Nicholas Clark <[email protected]>
Date: Sun Mar 2 15:36:52 2014 +0100
Tests that warnings are emitted if in-place edit fails to open a pathname.
These have the same text as other warnings which are tested. However the
existing tests only covered the code path where a directory was able to be
opened (read only) and then caught by an explicit stat test for non-files.
M t/lib/warnings/doio
-----------------------------------------------------------------------
--
Perl5 Master Repository