X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/8dc9003ff3914e78971f561eaece965e9ceeb49e..4aad0f36c806d1004a9a48feb3f05ce663280c29:/hv.c diff --git a/hv.c b/hv.c index 20b4ece..1371b2f 100644 --- a/hv.c +++ b/hv.c @@ -260,7 +260,9 @@ if all your code does is create SVs then store them in a hash, C will own the only reference to the new SV, and your code doesn't need to do anything further to tidy up. Note that C only reads the C; unlike C it does not take ownership of it, so maintaining the correct -reference count on C is entirely the caller's responsibility. C +reference count on C is entirely the caller's responsibility. The reason +it does not take ownership, is that C is not used after this function +returns, and so can be freed immediately. C is not implemented as a call to C, and does not create a temporary SV for the key, so if your key data is not already in SV form then use C in preference to C. @@ -988,7 +990,11 @@ void Perl_hv_pushkv(pTHX_ HV *hv, U32 flags) { HE *entry; - bool tied = SvRMAGICAL(hv) && mg_find(MUTABLE_SV(hv), PERL_MAGIC_tied); + bool tied = SvRMAGICAL(hv) && (mg_find(MUTABLE_SV(hv), PERL_MAGIC_tied) +#ifdef DYNAMIC_ENV_FETCH /* might not know number of keys yet */ + || mg_find(MUTABLE_SV(hv), PERL_MAGIC_env) +#endif + ); dSP; PERL_ARGS_ASSERT_HV_PUSHKV; @@ -1275,7 +1281,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, sv_2mortal((SV *)gv) ); } - else if (klen == 3 && strEQs(key, "ISA") && GvAV(gv)) { + else if (memEQs(key, klen, "ISA") && GvAV(gv)) { AV *isa = GvAV(gv); MAGIC *mg = mg_find((SV*)isa, PERL_MAGIC_isa); @@ -1291,7 +1297,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, SV **svp, **end; strip_magic: svp = AvARRAY(isa); - end = svp + AvFILLp(isa)+1; + end = svp + (AvFILLp(isa)+1); while (svp < end) { if (*svp) mg_free_type(*svp, PERL_MAGIC_isaelem);