summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-05-11 09:34:13 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-05-11 09:34:13 +0000
commita6c403648ecd5cc72235fdb1e7535523a8ff2ac9 (patch)
treeae379cb0349ea1800627a86bc0ddf04fea4403ec /hv.c
parent312caa8e97f1c7ee342a9895c2f0e749625b4929 (diff)
downloadperl-a6c403648ecd5cc72235fdb1e7535523a8ff2ac9.tar.gz
various fixes for clean build and test on win32; configpm broken,
needed to open myconfig.SH rather than myconfig; sundry adjustments to bytecode stuff; tweaks to DYNAMIC_ENV_FETCH code to make it work under win32; getenv_sv() changed to getenv_len() since SVs aren't visible in the lower echelons; remove bogus exports from config.sym; PERL_OBJECT-ness for C++ exception support; null out IoDIRP in filter_del() or sv_free() will attempt to close it p4raw-id: //depot/perl@3387
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/hv.c b/hv.c
index e7a73ce852..d21af5c4c7 100644
--- a/hv.c
+++ b/hv.c
@@ -150,10 +150,13 @@ hv_fetch(HV *hv, const char *key, U32 klen, I32 lval)
}
#ifdef DYNAMIC_ENV_FETCH /* %ENV lookup? If so, try to fetch the value now */
if (HvNAME(hv) && strEQ(HvNAME(hv),ENV_HV_NAME)) {
- if ((sv = PerlEnv_ENVgetenv_sv(key)) != &PL_sv_undef) {
- SvTAINTED_on(sv);
- return hv_store(hv,key,klen,sv,hash);
- }
+ unsigned long len;
+ char *env = PerlEnv_ENVgetenv_len(key,&len);
+ if (env) {
+ sv = newSVpvn(env,len);
+ SvTAINTED_on(sv);
+ return hv_store(hv,key,klen,sv,hash);
+ }
}
#endif
if (lval) { /* gonna assign to this, so it better be there */
@@ -238,10 +241,13 @@ hv_fetch_ent(HV *hv, SV *keysv, I32 lval, register U32 hash)
}
#ifdef DYNAMIC_ENV_FETCH /* %ENV lookup? If so, try to fetch the value now */
if (HvNAME(hv) && strEQ(HvNAME(hv),ENV_HV_NAME)) {
- if ((sv = PerlEnv_ENVgetenv_sv(key)) != &PL_sv_undef) {
- SvTAINTED_on(sv);
- return hv_store_ent(hv,keysv,sv,hash);
- }
+ unsigned long len;
+ char *env = PerlEnv_ENVgetenv_len(key,&len);
+ if (env) {
+ sv = newSVpvn(env,len);
+ SvTAINTED_on(sv);
+ return hv_store_ent(hv,keysv,sv,hash);
+ }
}
#endif
if (lval) { /* gonna assign to this, so it better be there */
@@ -613,11 +619,15 @@ hv_exists(HV *hv, const char *key, U32 klen)
return TRUE;
}
#ifdef DYNAMIC_ENV_FETCH /* is it out there? */
- if (HvNAME(hv) && strEQ(HvNAME(hv), ENV_HV_NAME) &&
- (sv = PerlEnv_ENVgetenv_sv(key)) != &PL_sv_undef) {
- SvTAINTED_on(sv);
- hv_store(hv,key,klen,sv,hash);
- return TRUE;
+ if (HvNAME(hv) && strEQ(HvNAME(hv), ENV_HV_NAME)) {
+ unsigned long len;
+ char *env = PerlEnv_ENVgetenv_len(key,&len);
+ if (env) {
+ sv = newSVpvn(env,len);
+ SvTAINTED_on(sv);
+ (void)hv_store(hv,key,klen,sv,hash);
+ return TRUE;
+ }
}
#endif
return FALSE;
@@ -680,11 +690,15 @@ hv_exists_ent(HV *hv, SV *keysv, U32 hash)
return TRUE;
}
#ifdef DYNAMIC_ENV_FETCH /* is it out there? */
- if (HvNAME(hv) && strEQ(HvNAME(hv), ENV_HV_NAME) &&
- (sv = PerlEnv_ENVgetenv_sv(key)) != &PL_sv_undef) {
- SvTAINTED_on(sv);
- hv_store_ent(hv,keysv,sv,hash);
- return TRUE;
+ if (HvNAME(hv) && strEQ(HvNAME(hv), ENV_HV_NAME)) {
+ unsigned long len;
+ char *env = PerlEnv_ENVgetenv_len(key,&len);
+ if (env) {
+ sv = newSVpvn(env,len);
+ SvTAINTED_on(sv);
+ (void)hv_store_ent(hv,keysv,sv,hash);
+ return TRUE;
+ }
}
#endif
return FALSE;