if (PERL_REVISION > 127 || PERL_VERSION > 127 || PERL_SUBVERSION > 127)
SvGROW(PL_patchlevel, UTF8_MAXLEN*3+1);
s = (U8*)SvPVX(PL_patchlevel);
- s = uv_to_utf8(s, (UV)PERL_REVISION);
- s = uv_to_utf8(s, (UV)PERL_VERSION);
- s = uv_to_utf8(s, (UV)PERL_SUBVERSION);
+ s = uv_to_utf8(s, (UV)(ASCII_TO_NATIVE(PERL_REVISION)));
+ s = uv_to_utf8(s, (UV)(ASCII_TO_NATIVE(PERL_VERSION)));
+ s = uv_to_utf8(s, (UV)(ASCII_TO_NATIVE(PERL_SUBVERSION)));
*s = '\0';
SvCUR_set(PL_patchlevel, s - (U8*)SvPVX(PL_patchlevel));
SvPOK_on(PL_patchlevel);
return;
}
+ /* jettison our possibly duplicated environment */
+
+#ifdef USE_ENVIRON_ARRAY
+ if (environ != PL_origenviron) {
+ I32 i;
+
+ for (i = 0; environ[i]; i++)
+ safesysfree(environ[i]);
+ /* Must use safesysfree() when working with environ. */
+ safesysfree(environ);
+
+ environ = PL_origenviron;
+ }
+#endif
+
/* loosen bonds of global variables */
if(PL_rsfp) {
Safefree(PL_op_mask);
Safefree(PL_psig_ptr);
Safefree(PL_psig_name);
+ Safefree(PL_bitcount);
Safefree(PL_psig_pend);
nuke_stacks();
PL_hints = 0; /* Reset hints. Should hints be per-interpreter ? */
PL_debug = atoi(s+1);
for (s++; isDIGIT(*s); s++) ;
}
- PL_debug |= 0x80000000;
+ PL_debug |= DEBUG_TOP_FLAG;
#else
if (ckWARN_d(WARN_DEBUGGING))
Perl_warner(aTHX_ WARN_DEBUGGING,
HV *hv;
GvMULTI_on(PL_envgv);
hv = GvHVn(PL_envgv);
- hv_magic(hv, PL_envgv, 'E');
+ hv_magic(hv, Nullgv, 'E');
#ifdef USE_ENVIRON_ARRAY
/* Note that if the supplied env parameter is actually a copy
of the global environ then it may now point to free'd memory
for (env_base = env; *env; env++)
dup_env_count++;
if ((dup_env_base = (char **)
- safemalloc( sizeof(char *) * (dup_env_count+1) ))) {
+ safesysmalloc( sizeof(char *) * (dup_env_count+1) ))) {
char **dup_env;
for (env = env_base, dup_env = dup_env_base;
*env;
- env++, dup_env++)
- *dup_env = savepv(*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? */
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(). */
- (void)PerlEnv_putenv(savepv(*env));
-#endif
}
+#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
if (dup_env_base) {
char **dup_env;
for (dup_env = dup_env_base; *dup_env; dup_env++)
- Safefree(*dup_env);
- Safefree(dup_env_base);
+ safesysfree(*dup_env);
+ safesysfree(dup_env_base);
}
+#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */
#endif /* USE_ENVIRON_ARRAY */
#ifdef DYNAMIC_ENV_FETCH
HvNAME(hv) = savepv(ENV_HV_NAME);