Change 13660 by jhi@alpha on 2001/12/12 15:04:03
Subject: [PATCH] Passing in env to perl_parse did not work
From: Gisle Aas <[EMAIL PROTECTED]>
Date: 11 Dec 2001 20:52:57 -0800
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/perl.c#399 edit
.... //depot/perl/perl.h#423 edit
Differences ...
==== //depot/perl/perl.c#399 (text) ====
Index: perl/perl.c
--- perl/perl.c.~1~ Wed Dec 12 08:15:05 2001
+++ perl/perl.c Wed Dec 12 08:15:05 2001
@@ -3430,10 +3430,6 @@
char *s;
SV *sv;
GV* tmpgv;
-#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
- char **dup_env_base = 0;
- int dup_env_count = 0;
-#endif
PL_toptarget = NEWSV(0,0);
sv_upgrade(PL_toptarget, SVt_PVFM);
@@ -3482,46 +3478,20 @@
env = environ;
if (env != environ)
environ[0] = Nullch;
-#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
- {
- char **env_base;
- for (env_base = env; *env; env++)
- dup_env_count++;
- if ((dup_env_base = (char **)
- safesysmalloc( sizeof(char *) * (dup_env_count+1) ))) {
- char **dup_env;
- for (env = env_base, dup_env = dup_env_base;
- *env;
- env++, dup_env++) {
- /* With environ one needs to use safesysmalloc(). */
- *dup_env = safesysmalloc(strlen(*env) + 1);
- (void)strcpy(*dup_env, *env);
- }
- *dup_env = Nullch;
- env = dup_env_base;
- } /* else what? */
- }
-#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */
if (env)
for (; *env; env++) {
if (!(s = strchr(*env,'=')))
continue;
- *s++ = '\0';
#if defined(MSDOS)
+ *s = '\0';
(void)strupr(*env);
+ *s = '=';
#endif
- sv = newSVpv(s--,0);
+ sv = newSVpv(s+1, 0);
(void)hv_store(hv, *env, s - *env, sv, 0);
- *s = '=';
+ if (env != environ)
+ mg_set(sv);
}
-#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
- if (dup_env_base) {
- char **dup_env;
- for (dup_env = dup_env_base; *dup_env; dup_env++)
- safesysfree(*dup_env);
- safesysfree(dup_env_base);
- }
-#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */
#endif /* USE_ENVIRON_ARRAY */
}
TAINT_NOT;
==== //depot/perl/perl.h#423 (text) ====
Index: perl/perl.h
--- perl/perl.h.~1~ Wed Dec 12 08:15:05 2001
+++ perl/perl.h Wed Dec 12 08:15:05 2001
@@ -1814,13 +1814,6 @@
# define USE_ENVIRON_ARRAY
#endif
-#ifdef JPL
- /* E.g. JPL needs to operate on a copy of the real environment.
- * JDK 1.2 and 1.3 seem to get upset if the original environment
- * is diddled with. */
-# define NEED_ENVIRON_DUP_FOR_MODIFY
-#endif
-
/*
* initialise to avoid floating-point exceptions from overflow, etc
*/
End of Patch.