summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorAaron Crane <arc@cpan.org>2017-10-13 16:30:05 +0200
committerAaron Crane <arc@cpan.org>2017-10-21 16:53:06 +0100
commit4009c3ff1ea01581837a8fd419a882e219b298b8 (patch)
treed16141d8ab6afb1df2ce6a22eaed51bd0f7acf36 /doio.c
parentd4bd48023fe0ba950fface5aa859b6852aa29fc4 (diff)
downloadperl-4009c3ff1ea01581837a8fd419a882e219b298b8.tar.gz
doio.c: simplify cpp conditionals
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/doio.c b/doio.c
index 04bbe7e5d1..e7b78f8359 100644
--- a/doio.c
+++ b/doio.c
@@ -1150,11 +1150,9 @@ Perl_nextargv(pTHX_ GV *gv, bool nomagicopen)
/* XXX silently ignore failures */
#ifdef HAS_FCHOWN
PERL_UNUSED_RESULT(fchown(PL_lastfd,fileuid,filegid));
-#else
-#ifdef HAS_CHOWN
+#elif defined(HAS_CHOWN)
PERL_UNUSED_RESULT(PerlLIO_chown(PL_oldname,fileuid,filegid));
#endif
-#endif
}
}
return IoIFP(GvIOp(gv));
@@ -1383,14 +1381,12 @@ Perl_do_close(pTHX_ GV *gv, bool not_implicit)
}
#endif
if (
-#ifdef HAS_RENAME
-# ifdef ARGV_USE_ATFUNCTIONS
+#if !defined(HAS_RENAME)
+ link(SvPVX(*temp_psv), orig_pv) < 0
+#elif defined(ARGV_USE_ATFUNCTIONS)
S_my_renameat(dfd, SvPVX(*temp_psv), dfd, orig_pv) < 0
-# else
- PerlLIO_rename(SvPVX(*temp_psv), orig_pv) < 0
-# endif
#else
- link(SvPVX(*temp_psv), orig_pv) < 0
+ PerlLIO_rename(SvPVX(*temp_psv), orig_pv) < 0
#endif
) {
if (!not_implicit) {
@@ -2923,33 +2919,29 @@ Perl_start_glob (pTHX_ SV *tmpglob, IO *io)
fp = Perl_vms_start_glob(aTHX_ tmpglob, io);
#else /* !VMS */
-#ifdef DOSISH
-#ifdef OS2
+# ifdef DOSISH
+# if defined(OS2)
sv_setpv(tmpcmd, "for a in ");
sv_catsv(tmpcmd, tmpglob);
sv_catpv(tmpcmd, "; do echo \"$a\\0\\c\"; done |");
-#else
-#ifdef DJGPP
+# elif defined(DJGPP)
sv_setpv(tmpcmd, "/dev/dosglob/"); /* File System Extension */
sv_catsv(tmpcmd, tmpglob);
-#else
+# else
sv_setpv(tmpcmd, "perlglob ");
sv_catsv(tmpcmd, tmpglob);
sv_catpv(tmpcmd, " |");
-#endif /* !DJGPP */
-#endif /* !OS2 */
-#else /* !DOSISH */
-#if defined(CSH)
+# endif
+# elif defined(CSH)
sv_setpvn(tmpcmd, PL_cshname, PL_cshlen);
sv_catpv(tmpcmd, " -cf 'set nonomatch; glob ");
sv_catsv(tmpcmd, tmpglob);
sv_catpv(tmpcmd, "' 2>/dev/null |");
-#else
+# else
sv_setpv(tmpcmd, "echo ");
sv_catsv(tmpcmd, tmpglob);
sv_catpv(tmpcmd, "|tr -s ' \t\f\r' '\\n\\n\\n\\n'|");
-#endif /* !CSH */
-#endif /* !DOSISH */
+# endif /* !DOSISH && !CSH */
{
SV ** const svp = hv_fetchs(GvHVn(PL_envgv), "LS_COLORS", 0);
if (svp && *svp)