summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-02-08 13:23:16 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-02-08 13:23:16 +0000
commitf25172013443eb112285f24a09b83900edb8a738 (patch)
tree678f9789da4edbccaa4836270985332e36f7f449 /mg.c
parent651b9576cc8d7812bbcba060854ec8a56f698aae (diff)
downloadperl-f25172013443eb112285f24a09b83900edb8a738.tar.gz
make safesysmalloc() etc., always available; safemalloc() et al are
now macros that point to the right malloc; fix various places in sources that need to always use safesysmalloc() et al p4raw-id: //depot/perl@2834
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/mg.c b/mg.c
index 9547da88d2..bab5298acb 100644
--- a/mg.c
+++ b/mg.c
@@ -880,7 +880,7 @@ magic_clear_all_env(SV *sv, MAGIC *mg)
#if defined(VMS)
die("Can't make list assignment to %%ENV on this system");
#else
-#ifdef WIN32
+# ifdef WIN32
char *envv = GetEnvironmentStrings();
char *cur = envv;
STRLEN len;
@@ -896,18 +896,21 @@ magic_clear_all_env(SV *sv, MAGIC *mg)
cur += len+1;
}
FreeEnvironmentStrings(envv);
-#else
+# else
+# ifndef PERL_USE_SAFE_PUTENV
I32 i;
if (environ == PL_origenviron)
- New(901, environ, 1, char*);
+ environ = (char**)safesysmalloc(sizeof(char*));
else
for (i = 0; environ[i]; i++)
- Safefree(environ[i]);
+ safesysfree(environ[i]);
+# endif /* PERL_USE_SAFE_PUTENV */
+
environ[0] = Nullch;
-#endif
-#endif
+# endif /* WIN32 */
+#endif /* VMS */
return 0;
}