From: Jerry D. Hedden Date: Mon, 1 Dec 2008 12:47:35 +0000 (-0500) Subject: Eliminate setenv_getix() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3a9222bef66d8694e74574667f2e773ea7c3f1ed;p=p5sagit%2Fp5-mst-13.2.git Eliminate setenv_getix() From: "Jerry D. Hedden" Message-ID: <1ff86f510812010947p7df19438kc19c279bcffe4b83@mail.gmail.com> Date: Mon, 1 Dec 2008 12:47:35 -0500 p4raw-id: //depot/perl@34971 --- diff --git a/embed.fnc b/embed.fnc index 4c735c3..b0aeea1 100644 --- a/embed.fnc +++ b/embed.fnc @@ -951,9 +951,6 @@ Apd |NV |scan_oct |NN const char* start|STRLEN len|NN STRLEN* retlen 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) diff --git a/embed.h b/embed.h index cf453ac..886f26b 100644 --- a/embed.h +++ b/embed.h @@ -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) diff --git a/proto.h b/proto.h index 5f07ad4..a2ed234 100644 --- a/proto.h +++ b/proto.h @@ -2962,13 +2962,6 @@ PERL_CALLCONV char* Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_ #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); diff --git a/util.c b/util.c index 67d0a13..ec7b479 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