summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-05-24 17:19:11 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-05-24 17:19:11 +0200
commitb15feb55e45b2354be3659a613d28786b2518244 (patch)
tree0d0fb3b7f0d542993a2f50aecd63dd139c2c5a92 /pp_ctl.c
parent4d87b51d9058eda1ac179d6f4b450110d2d5dff9 (diff)
downloadperl-b15feb55e45b2354be3659a613d28786b2518244.tar.gz
In the ~~ implementation, consistently use the SV-aware API for hash keys.
This way, we can handle tied hashes such as ones that have references as keys.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index e0c98ba21f..e12b6719a6 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4159,12 +4159,11 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
to check that one is a subset of the other. */
(void) hv_iterinit(hv);
while ( (he = hv_iternext(hv)) ) {
- I32 key_len;
- char * const key = hv_iterkey(he, &key_len);
+ SV *key = hv_iterkeysv(he);
++ this_key_count;
- if(!hv_exists(other_hv, key, key_len)) {
+ if(!hv_exists_ent(other_hv, key, 0)) {
(void) hv_iterinit(hv); /* reset iterator */
RETPUSHNO;
}
@@ -4191,12 +4190,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
for (i = 0; i < other_len; ++i) {
SV ** const svp = av_fetch(other_av, i, FALSE);
- char *key;
- STRLEN key_len;
-
if (svp) { /* ??? When can this not happen? */
- key = SvPV(*svp, key_len);
- if (hv_exists(hv, key, key_len))
+ if (hv_exists_ent(hv, *svp, 0))
RETPUSHYES;
}
}
@@ -4241,12 +4236,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
for (i = 0; i < other_len; ++i) {
SV ** const svp = av_fetch(other_av, i, FALSE);
- char *key;
- STRLEN key_len;
-
if (svp) { /* ??? When can this not happen? */
- key = SvPV(*svp, key_len);
- if (hv_exists(MUTABLE_HV(SvRV(d)), key, key_len))
+ if (hv_exists_ent(MUTABLE_HV(SvRV(d)), *svp, 0))
RETPUSHYES;
}
}