This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
caretx.c: simplify cpp conditionals
authorAaron Crane <arc@cpan.org>
Fri, 13 Oct 2017 13:59:59 +0000 (15:59 +0200)
committerAaron Crane <arc@cpan.org>
Sat, 21 Oct 2017 15:53:06 +0000 (16:53 +0100)
caretx.c

index 67b8418..d758f73 100644 (file)
--- a/caretx.c
+++ b/caretx.c
@@ -56,8 +56,7 @@ Perl_set_caret_X(pTHX) {
     SV *const caret_x = GvSV(tmpgv);
 #if defined(OS2)
     sv_setpv(caret_x, os2_execname(aTHX));
-#else
-#  ifdef USE_KERN_PROC_PATHNAME
+#elif defined(USE_KERN_PROC_PATHNAME)
     size_t size = 0;
     int mib[4];
     mib[0] = CTL_KERN;
@@ -77,7 +76,7 @@ Perl_set_caret_X(pTHX) {
             return;
         }
     }
-#  elif defined(USE_NSGETEXECUTABLEPATH)
+#elif defined(USE_NSGETEXECUTABLEPATH)
     char buf[1];
     uint32_t size = sizeof(buf);
 
@@ -96,7 +95,7 @@ Perl_set_caret_X(pTHX) {
             return;
         }
     }
-#  elif defined(HAS_PROCSELFEXE)
+#elif defined(HAS_PROCSELFEXE)
     char buf[MAXPATHLEN];
     SSize_t len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1);
     /* NOTE: if the length returned by readlink() is sizeof(buf) - 1,
@@ -126,7 +125,7 @@ Perl_set_caret_X(pTHX) {
         sv_setpvn(caret_x, buf, len);
         return;
     }
-#  elif defined(WIN32)
+#elif defined(WIN32)
     char *ansi;
     WCHAR widename[MAX_PATH];
     GetModuleFileNameW(NULL, widename, sizeof(widename)/sizeof(WCHAR));
@@ -134,7 +133,7 @@ Perl_set_caret_X(pTHX) {
     sv_setpv(caret_x, ansi);
     win32_free(ansi);
     return;
-#  endif
+#else
     /* Fallback to this:  */
     sv_setpv(caret_x, PL_origargv[0]);
 #endif