summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-09-19 15:53:43 +0000
committerNicholas Clark <nick@ccl4.org>2007-09-19 15:53:43 +0000
commitbdee33e435b03e47d573fcaecde743ced828beef (patch)
treececa61a5312ca76b14b9fd147a685988ca300450 /hv.c
parent72fe720030b6060280c28827922cc38c4c3cc4d6 (diff)
downloadperl-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.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/hv.c b/hv.c
index 8394a0e5b1..6d7c25adc7 100644
--- a/hv.c
+++ b/hv.c
@@ -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);