diff options
author | Abhijit Menon-Sen <ams@wiw.org> | 2001-06-16 13:11:19 +0530 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-16 23:18:37 +0000 |
commit | a3f1c6fb5f9cb8f8a03d70550bf7f1ebfba11774 (patch) | |
tree | 67599a33c08fe479c790f00c22630f89ecee952a | |
parent | 4521542890c02b2ddcb4a39429066bc380e4e5e7 (diff) | |
download | perl-a3f1c6fb5f9cb8f8a03d70550bf7f1ebfba11774.tar.gz |
Re: DYNAMIC_ENV_FETCH HvNAME abuse.
Message-ID: <20010616074119.A24720@lustre.linux.in>
p4raw-id: //depot/perl@10654
-rw-r--r-- | hv.c | 14 | ||||
-rw-r--r-- | perl.c | 3 | ||||
-rw-r--r-- | vms/vmsish.h | 1 | ||||
-rw-r--r-- | win32/win32.h | 1 |
4 files changed, 7 insertions, 12 deletions
@@ -188,7 +188,7 @@ Perl_hv_fetch(pTHX_ HV *hv, const char *key, I32 klen, I32 lval) if (!xhv->xhv_array) { if (lval #ifdef DYNAMIC_ENV_FETCH /* if it's an %ENV lookup, we may get it on the fly */ - || (HvNAME(hv) && strEQ(HvNAME(hv),ENV_HV_NAME)) + || mg_find((SV*)hv, PERL_MAGIC_env) #endif ) Newz(503, xhv->xhv_array, @@ -222,7 +222,7 @@ Perl_hv_fetch(pTHX_ HV *hv, const char *key, I32 klen, I32 lval) return &HeVAL(entry); } #ifdef DYNAMIC_ENV_FETCH /* %ENV lookup? If so, try to fetch the value now */ - if (HvNAME(hv) && strEQ(HvNAME(hv),ENV_HV_NAME)) { + if (mg_find((SV*)hv, PERL_MAGIC_env)) { unsigned long len; char *env = PerlEnv_ENVgetenv_len(key,&len); if (env) { @@ -317,7 +317,7 @@ Perl_hv_fetch_ent(pTHX_ HV *hv, SV *keysv, I32 lval, register U32 hash) if (!xhv->xhv_array) { if (lval #ifdef DYNAMIC_ENV_FETCH /* if it's an %ENV lookup, we may get it on the fly */ - || (HvNAME(hv) && strEQ(HvNAME(hv),ENV_HV_NAME)) + || mg_find((SV*)hv, PERL_MAGIC_env) #endif ) Newz(503, xhv->xhv_array, @@ -350,7 +350,7 @@ Perl_hv_fetch_ent(pTHX_ HV *hv, SV *keysv, I32 lval, register U32 hash) return entry; } #ifdef DYNAMIC_ENV_FETCH /* %ENV lookup? If so, try to fetch the value now */ - if (HvNAME(hv) && strEQ(HvNAME(hv),ENV_HV_NAME)) { + if (mg_find((SV*)hv, PERL_MAGIC_env)) { unsigned long len; char *env = PerlEnv_ENVgetenv_len(key,&len); if (env) { @@ -886,7 +886,7 @@ Perl_hv_exists(pTHX_ HV *hv, const char *key, I32 klen) return TRUE; } #ifdef DYNAMIC_ENV_FETCH /* is it out there? */ - if (HvNAME(hv) && strEQ(HvNAME(hv), ENV_HV_NAME)) { + if (mg_find((SV*)hv, PERL_MAGIC_env)) { unsigned long len; char *env = PerlEnv_ENVgetenv_len(key,&len); if (env) { @@ -978,7 +978,7 @@ Perl_hv_exists_ent(pTHX_ 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)) { + if (mg_find((SV*)hv, PERL_MAGIC_env)) { unsigned long len; char *env = PerlEnv_ENVgetenv_len(key,&len); if (env) { @@ -1414,7 +1414,7 @@ Perl_hv_iternext(pTHX_ HV *hv) return Null(HE*); } #ifdef DYNAMIC_ENV_FETCH /* set up %ENV for iteration */ - if (!entry && HvNAME(hv) && strEQ(HvNAME(hv), ENV_HV_NAME)) + if (!entry && mg_find((SV*)hv, PERL_MAGIC_env)) prime_env_iter(); #endif @@ -3443,9 +3443,6 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register } #endif /* NEED_ENVIRON_DUP_FOR_MODIFY */ #endif /* USE_ENVIRON_ARRAY */ -#ifdef DYNAMIC_ENV_FETCH - HvNAME(hv) = savepv(ENV_HV_NAME); -#endif } TAINT_NOT; if ((tmpgv = gv_fetchpv("$",TRUE, SVt_PV))) diff --git a/vms/vmsish.h b/vms/vmsish.h index a1f76301a4..7f4a3b3980 100644 --- a/vms/vmsish.h +++ b/vms/vmsish.h @@ -502,7 +502,6 @@ struct utimbuf { /* Look up new %ENV values on the fly */ #define DYNAMIC_ENV_FETCH 1 -#define ENV_HV_NAME "%EnV%VmS%" /* Special getenv function for retrieving %ENV elements. */ #define ENVgetenv(v) my_getenv(v,FALSE) #define ENVgetenv_len(v,l) my_getenv_len(v,l,FALSE) diff --git a/win32/win32.h b/win32/win32.h index dea3f9f5f7..58c19c36ff 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -15,7 +15,6 @@ #if defined(PERL_OBJECT) || defined(PERL_IMPLICIT_SYS) || defined(PERL_CAPI) # define DYNAMIC_ENV_FETCH -# define ENV_HV_NAME "___ENV_HV_NAME___" # define HAS_GETENV_LEN # define prime_env_iter() # define WIN32IO_IS_STDIO /* don't pull in custom stdio layer */ |