summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-02-23 20:02:25 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-02-23 20:02:25 +0000
commit2d7c14ee4980d18d982b4709ee152c49510a6872 (patch)
treeaab14ae3f134d06b3375a234d348c47598fb529b /util.c
parenteacec437e0f082d8ac91fe7ac7f3e60f5e692905 (diff)
downloadperl-2d7c14ee4980d18d982b4709ee152c49510a6872.tar.gz
Abolish USE_WIN32_RTL_ENV.
p4raw-id: //depot/perl@8916
Diffstat (limited to 'util.c')
-rw-r--r--util.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/util.c b/util.c
index 409307f4f3..e24a81d19f 100644
--- a/util.c
+++ b/util.c
@@ -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 */