diff options
-rw-r--r-- | perl.c | 9 | ||||
-rw-r--r-- | util.c | 43 | ||||
-rw-r--r-- | win32/win32.c | 4 | ||||
-rw-r--r-- | win32/win32.h | 5 | ||||
-rw-r--r-- | win32/win32iop.h | 4 |
5 files changed, 0 insertions, 65 deletions
@@ -3382,15 +3382,6 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register sv = newSVpv(s--,0); (void)hv_store(hv, *env, s - *env, sv, 0); *s = '='; -#if defined(__BORLANDC__) && defined(USE_WIN32_RTL_ENV) - /* Sins of the RTL. See note in my_setenv(). */ - { - STRLEN len = strlen(*env); - char *e = safesysmalloc(len+1); - (void)strcpy(e, *env); - (void)PerlEnv_putenv(e); - } -#endif } #ifdef NEED_ENVIRON_DUP_FOR_MODIFY if (dup_env_base) { @@ -2039,47 +2039,6 @@ Perl_my_setenv(pTHX_ char *nam, char *val) void Perl_my_setenv(pTHX_ char *nam,char *val) { - -#ifdef USE_WIN32_RTL_ENV - - register char *envstr; - STRLEN namlen = strlen(nam); - STRLEN vallen; - char *oldstr = environ[setenv_getix(nam)]; - - /* putenv() has totally broken semantics in both the Borland - * and Microsoft CRTLs. They either store the passed pointer in - * the environment without making a copy, or make a copy and don't - * free it. And on top of that, they dont free() old entries that - * are being replaced/deleted. This means the caller must - * free any old entries somehow, or we end up with a memory - * leak every time my_setenv() is called. One might think - * one could directly manipulate environ[], like the UNIX code - * above, but direct changes to environ are not allowed when - * calling putenv(), since the RTLs maintain an internal - * *copy* of environ[]. Bad, bad, *bad* stink. - * GSAR 97-06-07 - */ - - if (!val) { - if (!oldstr) - return; - val = ""; - vallen = 0; - } - else - vallen = strlen(val); - envstr = (char*)safesysmalloc((namlen + vallen + 3) * sizeof(char)); - (void)sprintf(envstr,"%s=%s",nam,val); - (void)PerlEnv_putenv(envstr); - if (oldstr) - safesysfree(oldstr); -#ifdef _MSC_VER - safesysfree(envstr); /* MSVCRT leaks without this */ -#endif - -#else /* !USE_WIN32_RTL_ENV */ - register char *envstr; STRLEN len = strlen(nam) + 3; if (!val) { @@ -2090,8 +2049,6 @@ Perl_my_setenv(pTHX_ char *nam,char *val) (void)sprintf(envstr,"%s=%s",nam,val); (void)PerlEnv_putenv(envstr); Safefree(envstr); - -#endif } #endif /* WIN32 */ diff --git a/win32/win32.c b/win32/win32.c index ba445a488b..226ef9b7c0 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1322,8 +1322,6 @@ win32_longpath(char *path) return path; } -#ifndef USE_WIN32_RTL_ENV - DllExport char * win32_getenv(const char *name) { @@ -1425,8 +1423,6 @@ win32_putenv(const char *name) return relval; } -#endif - static long filetime_to_clock(PFILETIME ft) { diff --git a/win32/win32.h b/win32/win32.h index 1040ef1c1a..232542c580 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -122,11 +122,6 @@ struct utsname { #define PERL_NO_FORCE_LINK /* no need for PL_force_link_funcs */ -/* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls - * to read the environment, bypassing the runtime's (usually broken) - * facilities for accessing the same. See note in util.c/my_setenv(). */ -/*#define USE_WIN32_RTL_ENV */ - /* Define USE_FIXED_OSFHANDLE to fix MSVCRT's _open_osfhandle() on W95. It now uses some black magic to work seamlessly with the DLL CRT and works with MSVC++ 4.0+ or GCC/Mingw32 diff --git a/win32/win32iop.h b/win32/win32iop.h index 5629babe83..5412f5e9a3 100644 --- a/win32/win32iop.h +++ b/win32/win32iop.h @@ -120,10 +120,8 @@ DllExport void win32_seekdir(DIR *dirp, long loc); DllExport void win32_rewinddir(DIR *dirp); DllExport int win32_closedir(DIR *dirp); -#ifndef USE_WIN32_RTL_ENV DllExport char* win32_getenv(const char *name); DllExport int win32_putenv(const char *name); -#endif DllExport unsigned win32_sleep(unsigned int); DllExport int win32_times(struct tms *timebuf); @@ -300,12 +298,10 @@ END_EXTERN_C #undef crypt #define crypt(t,s) win32_crypt(t,s) -#ifndef USE_WIN32_RTL_ENV #undef getenv #define getenv win32_getenv #undef putenv #define putenv win32_putenv -#endif #endif /* WIN32IO_IS_STDIO */ #endif /* WIN32IOP_H */ |