summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJerry D. Hedden <jdhedden@cpan.org>2008-12-01 07:47:35 -0500
committerNicholas Clark <nick@ccl4.org>2008-12-01 19:54:11 +0000
commit3a9222bef66d8694e74574667f2e773ea7c3f1ed (patch)
tree1f51296172a3bbd748f76207f88d94c2fd9fc5dc /util.c
parent9e730509907b8752181af8e7fd62436ee39ccc0a (diff)
downloadperl-3a9222bef66d8694e74574667f2e773ea7c3f1ed.tar.gz
Eliminate setenv_getix()
From: "Jerry D. Hedden" <jdhedden@cpan.org> Message-ID: <1ff86f510812010947p7df19438kc19c279bcffe4b83@mail.gmail.com> Date: Mon, 1 Dec 2008 12:47:35 -0500 p4raw-id: //depot/perl@34971
Diffstat (limited to 'util.c')
-rw-r--r--util.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/util.c b/util.c
index 67d0a13fac..ec7b479a97 100644
--- a/util.c
+++ b/util.c
@@ -1667,9 +1667,16 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val)
#ifndef PERL_USE_SAFE_PUTENV
if (!PL_use_safe_putenv) {
/* most putenv()s leak, so we manipulate environ directly */
- register I32 i=setenv_getix(nam); /* where does it go? */
+ register I32 i;
+ register const I32 len = strlen(nam);
int nlen, vlen;
+ /* where does it go? */
+ for (i = 0; environ[i]; i++) {
+ if (strnEQ(environ[i],nam,len) && environ[i][len] == '=')
+ break;
+ }
+
if (environ == PL_origenviron) { /* need we copy environment? */
I32 j;
I32 max;
@@ -1773,30 +1780,6 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val)
#endif /* WIN32 || NETWARE */
-#ifndef PERL_MICRO
-static I32
-S_setenv_getix(pTHX_ const char *nam)
-{
- register I32 i;
- register const I32 len = strlen(nam);
-
- PERL_ARGS_ASSERT_SETENV_GETIX;
- PERL_UNUSED_CONTEXT;
-
- for (i = 0; environ[i]; i++) {
- if (
-#ifdef WIN32
- strnicmp(environ[i],nam,len) == 0
-#else
- strnEQ(environ[i],nam,len)
-#endif
- && environ[i][len] == '=')
- break; /* strnEQ must come first to avoid */
- } /* potential SEGV's */
- return i;
-}
-#endif /* !PERL_MICRO */
-
#endif /* !VMS && !EPOC*/
#ifdef UNLINK_ALL_VERSIONS