Change 34971 by [EMAIL PROTECTED] on 2008/12/01 19:54:11
Subject: [PATCH] Eliminate setenv_getix()
From: "Jerry D. Hedden" <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Date: Mon, 1 Dec 2008 12:47:35 -0500
Affected files ...
... //depot/perl/embed.fnc#663 edit
... //depot/perl/embed.h#796 edit
... //depot/perl/proto.h#994 edit
... //depot/perl/util.c#672 edit
Differences ...
==== //depot/perl/embed.fnc#663 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#662~34966~ 2008-12-01 03:27:31.000000000 -0800
+++ perl/embed.fnc 2008-12-01 11:54:11.000000000 -0800
@@ -951,9 +951,6 @@
p |OP* |scope |NULLOK OP* o
Ap |char* |screaminstr |NN SV *bigstr|NN SV *littlestr|I32 start_shift
\
|I32 end_shift|NN I32 *old_posp|I32 last
-#if !defined(VMS) && defined(PERL_IN_UTIL_C)
-s |I32 |setenv_getix |NN const char* nam
-#endif
Apd |void |setdefout |NULLOK GV* gv
Ap |HEK* |share_hek |NN const char* str|I32 len|U32 hash
#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
==== //depot/perl/embed.h#796 (text+w) ====
Index: perl/embed.h
--- perl/embed.h#795~34966~ 2008-12-01 03:27:31.000000000 -0800
+++ perl/embed.h 2008-12-01 11:54:11.000000000 -0800
@@ -839,11 +839,6 @@
#define scope Perl_scope
#endif
#define screaminstr Perl_screaminstr
-#if !defined(VMS) && defined(PERL_IN_UTIL_C)
-#ifdef PERL_CORE
-#define setenv_getix S_setenv_getix
-#endif
-#endif
#define setdefout Perl_setdefout
#define share_hek Perl_share_hek
#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
@@ -3195,11 +3190,6 @@
#define scope(a) Perl_scope(aTHX_ a)
#endif
#define screaminstr(a,b,c,d,e,f) Perl_screaminstr(aTHX_ a,b,c,d,e,f)
-#if !defined(VMS) && defined(PERL_IN_UTIL_C)
-#ifdef PERL_CORE
-#define setenv_getix(a) S_setenv_getix(aTHX_ a)
-#endif
-#endif
#define setdefout(a) Perl_setdefout(aTHX_ a)
#define share_hek(a,b,c) Perl_share_hek(aTHX_ a,b,c)
#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
==== //depot/perl/proto.h#994 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#993~34966~ 2008-12-01 03:27:31.000000000 -0800
+++ perl/proto.h 2008-12-01 11:54:11.000000000 -0800
@@ -2962,13 +2962,6 @@
#define PERL_ARGS_ASSERT_SCREAMINSTR \
assert(bigstr); assert(littlestr); assert(old_posp)
-#if !defined(VMS) && defined(PERL_IN_UTIL_C)
-STATIC I32 S_setenv_getix(pTHX_ const char* nam)
- __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_SETENV_GETIX \
- assert(nam)
-
-#endif
PERL_CALLCONV void Perl_setdefout(pTHX_ GV* gv);
PERL_CALLCONV HEK* Perl_share_hek(pTHX_ const char* str, I32 len, U32 hash)
__attribute__nonnull__(pTHX_1);
==== //depot/perl/util.c#672 (text) ====
Index: perl/util.c
--- perl/util.c#671~34940~ 2008-11-26 15:20:31.000000000 -0800
+++ perl/util.c 2008-12-01 11:54:11.000000000 -0800
@@ -1667,9 +1667,16 @@
#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 @@
#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
End of Patch.