summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-02-22 13:55:49 +0100
committerNicholas Clark <nick@ccl4.org>2009-02-22 13:55:49 +0100
commit32910c7adf92931ec848030a4246989515a37670 (patch)
tree9fdaf1f6bcbb2a16a3d21cddc48bdc854e9e1ed3 /perl.c
parent2cace6acdfad87b2d298bff18b91b339c18fd1e3 (diff)
downloadperl-32910c7adf92931ec848030a4246989515a37670.tar.gz
In S_init_perllib(), only call PerlEnv_getenv("PERL5LIB") once.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/perl.c b/perl.c
index c76e5f3163..6e4e3e44bd 100644
--- a/perl.c
+++ b/perl.c
@@ -4092,6 +4092,9 @@ STATIC void
S_init_perllib(pTHX)
{
dVAR;
+#ifndef VMS
+ const char *perl5lib;
+#endif
char *s;
#ifdef WIN32
STRLEN len;
@@ -4099,18 +4102,18 @@ S_init_perllib(pTHX)
if (!PL_tainting) {
#ifndef VMS
- s = PerlEnv_getenv("PERL5LIB");
+ perl5lib = PerlEnv_getenv("PERL5LIB");
/*
* It isn't possible to delete an environment variable with
* PERL_USE_SAFE_PUTENV set unless unsetenv() is also available, so in that
* case we treat PERL5LIB as undefined if it has a zero-length value.
*/
#if defined(PERL_USE_SAFE_PUTENV) && ! defined(HAS_UNSETENV)
- if (s && *s != '\0')
+ if (perl5lib && *perl5lib != '\0')
#else
- if (s)
+ if (perl5lib)
#endif
- incpush_use_sep(s, 0, INCPUSH_ADD_SUB_DIRS);
+ incpush_use_sep(perl5lib, 0, INCPUSH_ADD_SUB_DIRS);
else {
s = PerlEnv_getenv("PERLLIB");
if (s)
@@ -4241,18 +4244,18 @@ S_init_perllib(pTHX)
if (!PL_tainting) {
#ifndef VMS
- s = PerlEnv_getenv("PERL5LIB");
/*
* It isn't possible to delete an environment variable with
* PERL_USE_SAFE_PUTENV set unless unsetenv() is also available, so in that
* case we treat PERL5LIB as undefined if it has a zero-length value.
*/
#if defined(PERL_USE_SAFE_PUTENV) && ! defined(HAS_UNSETENV)
- if (s && *s != '\0')
+ if (perl5lib && *perl5lib != '\0')
#else
- if (s)
+ if (perl5lib)
#endif
- incpush_use_sep(s, 0, INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR);
+ incpush_use_sep(perl5lib, 0,
+ INCPUSH_ADD_OLD_VERS|INCPUSH_NOT_BASEDIR);
#else /* VMS */
/* Treat PERL5?LIB as a possible search list logical name -- the
* "natural" VMS idiom for a Unix path string. We allow each