summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-05-13 04:17:16 -0600
committerKarl Williamson <khw@cpan.org>2022-05-27 21:26:28 -0600
commitd64b73b99ae52cc4ff79199859f090499f63e39c (patch)
tree8264c5a189b3fec194c756bf2b1f75a5f22dc537 /doio.c
parentd4192ed96f792bc52e5c3779b4dfdfcf987cb6bf (diff)
downloadperl-d64b73b99ae52cc4ff79199859f090499f63e39c.tar.gz
doio.c: Rename formal parameters for clarity
This was named 'not_implicit' instead of 'explicit' because the latter is a C++ keyword. But a negative name increases the cognitive load of understanding, and in this case resulted in some double negatives, which is worse. 'is_explicit' isn't a keyword and is a clearer name for this concept.
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/doio.c b/doio.c
index f0d451af3c..db04a10768 100644
--- a/doio.c
+++ b/doio.c
@@ -1632,7 +1632,7 @@ S_dir_unchanged(pTHX_ const char *orig_pv, MAGIC *mg) {
S_dir_unchanged(aTHX_ (orig_psv), (mg))
STATIC bool
-S_argvout_final(pTHX_ MAGIC *mg, IO *io, bool not_implicit) {
+S_argvout_final(pTHX_ MAGIC *mg, IO *io, bool is_explict) {
bool retval;
/* ensure args are checked before we start using them */
@@ -1679,7 +1679,7 @@ S_argvout_final(pTHX_ MAGIC *mg, IO *io, bool not_implicit) {
#endif
}
- retval = io_close(io, NULL, not_implicit, FALSE);
+ retval = io_close(io, NULL, is_explict, FALSE);
if (SvIV(*pid_psv) != (IV)PerlProc_getpid()) {
/* this is a child process, don't duplicate our rename() etc
@@ -1724,7 +1724,7 @@ S_argvout_final(pTHX_ MAGIC *mg, IO *io, bool not_implicit) {
PerlLIO_rename(orig_pv, SvPVX(*back_psv)) < 0
# endif
) {
- if (!not_implicit) {
+ if (!is_explict) {
# ifdef ARGV_USE_ATFUNCTIONS
if (unlinkat(dfd, SvPVX_const(*temp_psv), 0) < 0 &&
UNLIKELY(NotSupported(errno)) &&
@@ -1742,7 +1742,7 @@ S_argvout_final(pTHX_ MAGIC *mg, IO *io, bool not_implicit) {
#else
(void)UNLINK(SvPVX(*back_psv));
if (link(orig_pv, SvPVX(*back_psv))) {
- if (!not_implicit) {
+ if (!is_explict) {
Perl_croak(aTHX_ "Can't rename %s to %s: %s, skipping file",
SvPVX(*orig_psv), SvPVX(*back_psv), Strerror(errno));
}
@@ -1771,7 +1771,7 @@ S_argvout_final(pTHX_ MAGIC *mg, IO *io, bool not_implicit) {
PerlLIO_rename(SvPVX(*temp_psv), orig_pv) < 0
#endif
) {
- if (!not_implicit) {
+ if (!is_explict) {
#ifdef ARGV_USE_ATFUNCTIONS
if (unlinkat(dfd, SvPVX_const(*temp_psv), 0) < 0 &&
NotSupported(errno))
@@ -1800,7 +1800,7 @@ S_argvout_final(pTHX_ MAGIC *mg, IO *io, bool not_implicit) {
#else
UNLINK(SvPVX_const(*temp_psv));
#endif
- if (!not_implicit) {
+ if (!is_explict) {
Perl_croak(aTHX_ "Failed to close in-place work file %s: %s",
SvPVX(*temp_psv), Strerror(errno));
}
@@ -1813,7 +1813,7 @@ S_argvout_final(pTHX_ MAGIC *mg, IO *io, bool not_implicit) {
/* explicit renamed to avoid C++ conflict -- kja */
bool
-Perl_do_close(pTHX_ GV *gv, bool not_implicit)
+Perl_do_close(pTHX_ GV *gv, bool is_explict)
{
bool retval;
IO *io;
@@ -1822,13 +1822,13 @@ Perl_do_close(pTHX_ GV *gv, bool not_implicit)
if (!gv)
gv = PL_argvgv;
if (!gv || !isGV_with_GP(gv)) {
- if (not_implicit)
+ if (is_explict)
SETERRNO(EBADF,SS_IVCHAN);
return FALSE;
}
io = GvIO(gv);
if (!io) { /* never opened */
- if (not_implicit) {
+ if (is_explict) {
report_evil_fh(gv);
SETERRNO(EBADF,SS_IVCHAN);
}
@@ -1836,13 +1836,13 @@ Perl_do_close(pTHX_ GV *gv, bool not_implicit)
}
if ((mg = mg_findext((SV*)io, PERL_MAGIC_uvar, &argvout_vtbl))
&& mg->mg_obj) {
- retval = argvout_final(mg, io, not_implicit);
+ retval = argvout_final(mg, io, is_explict);
mg_freeext((SV*)io, PERL_MAGIC_uvar, &argvout_vtbl);
}
else {
- retval = io_close(io, NULL, not_implicit, FALSE);
+ retval = io_close(io, NULL, is_explict, FALSE);
}
- if (not_implicit) {
+ if (is_explict) {
IoLINES(io) = 0;
IoPAGE(io) = 0;
IoLINES_LEFT(io) = IoPAGE_LEN(io);
@@ -1852,7 +1852,7 @@ Perl_do_close(pTHX_ GV *gv, bool not_implicit)
}
bool
-Perl_io_close(pTHX_ IO *io, GV *gv, bool not_implicit, bool warn_on_fail)
+Perl_io_close(pTHX_ IO *io, GV *gv, bool is_explict, bool warn_on_fail)
{
bool retval = FALSE;
@@ -1871,7 +1871,7 @@ Perl_io_close(pTHX_ IO *io, GV *gv, bool not_implicit, bool warn_on_fail)
*/
IoOFP(io) = IoIFP(io) = NULL;
status = PerlProc_pclose(fh);
- if (not_implicit) {
+ if (is_explict) {
STATUS_NATIVE_CHILD_SET(status);
retval = (STATUS_UNIX == 0);
}
@@ -1916,7 +1916,7 @@ Perl_io_close(pTHX_ IO *io, GV *gv, bool not_implicit, bool warn_on_fail)
SVfARG(get_sv("!",GV_ADD)));
}
}
- else if (not_implicit) {
+ else if (is_explict) {
SETERRNO(EBADF,SS_IVCHAN);
}