diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-09-19 15:53:43 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-09-19 15:53:43 +0000 |
commit | bdee33e435b03e47d573fcaecde743ced828beef (patch) | |
tree | ceca61a5312ca76b14b9fd147a685988ca300450 /hv.c | |
parent | 72fe720030b6060280c28827922cc38c4c3cc4d6 (diff) | |
download | perl-bdee33e435b03e47d573fcaecde743ced828beef.tar.gz |
Call the key transformation function for hv_exists()/hv_fetch()/
hv_store(). (And test this)
p4raw-id: //depot/perl@31912
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -423,17 +423,16 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, if (!hv) return NULL; + if (SvSMAGICAL(hv) && SvGMAGICAL(hv) && !(action & HV_DISABLE_UVAR_XKEY)) { + keysv = hv_magic_uvar_xkey(hv, keysv, key, klen, flags, action); + /* If a fetch-as-store fails on the fetch, then the action is to + recurse once into "hv_store". If we didn't do this, then that + recursive call would call the key conversion routine again. + However, as we replace the original key with the converted + key, this would result in a double conversion, which would show + up as a bug if the conversion routine is not idempotent. */ + } if (keysv) { - if (SvSMAGICAL(hv) && SvGMAGICAL(hv) - && !(action & HV_DISABLE_UVAR_XKEY)) { - keysv = hv_magic_uvar_xkey(hv, keysv, 0, 0, 0, action); - /* If a fetch-as-store fails on the fetch, then the action is to - recurse once into "hv_store". If we didn't do this, then that - recursive call would call the key conversion routine again. - However, as we replace the original key with the converted - key, this would result in a double conversion, which would show - up as a bug if the conversion routine is not idempotent. */ - } if (flags & HVhek_FREEKEY) Safefree(key); key = SvPV_const(keysv, klen); |