summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-04-19 17:43:09 +0200
committerYves Orton <demerphq@gmail.com>2022-04-19 17:43:09 +0200
commit1c9a202f729550823aec0f2728e63a89de0dc19b (patch)
treee427856fc2e1ec2587dd12ffd515014f4cef061a
parent4948e2deedbb0f9ed5b48e7a32e737b829a1cafe (diff)
downloadperl-1c9a202f729550823aec0f2728e63a89de0dc19b.tar.gz
mg.c - move const initialization out of loop
The path_sep is not going to change per iteration of the loop, so just move it out of the loop.
-rw-r--r--mg.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mg.c b/mg.c
index c470beaec1..7a4727cedf 100644
--- a/mg.c
+++ b/mg.c
@@ -1350,6 +1350,11 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
#endif /* VMS */
if (s && memEQs(key, klen, "PATH")) {
const char * const strend = s + len;
+#ifdef __VMS /* Hmm. How do we get $Config{path_sep} from C? */
+ const char path_sep = PL_perllib_sep;
+#else
+ const char path_sep = ':';
+#endif
/* set MGf_TAINTEDDIR if any component of the new path is
* relative or world-writeable */
@@ -1357,11 +1362,6 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
char tmpbuf[256];
Stat_t st;
I32 i;
-#ifdef __VMS /* Hmm. How do we get $Config{path_sep} from C? */
- const char path_sep = PL_perllib_sep;
-#else
- const char path_sep = ':';
-#endif
s = delimcpy_no_escape(tmpbuf, tmpbuf + sizeof tmpbuf,
s, strend, path_sep, &i);
s++;