diff options
author | Dmitry Karasik <dk@tetsuo.karasik.eu.org> | 2007-11-28 22:49:59 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-11-30 13:58:24 +0000 |
commit | 71b0fb349652fe857463343442555853e4b1c085 (patch) | |
tree | 80cdb6a26df79ef2f19722ddf80ce09ce8459f11 /pp_ctl.c | |
parent | e04eebfa7ebcc60f8601791519926fd635df36a1 (diff) | |
download | perl-71b0fb349652fe857463343442555853e4b1c085.tar.gz |
Re: smart match: array ~~ hash
Message-ID: <20071128204959.GA68977@tetsuo.karasik.eu.org>
plus more tests.
p4raw-id: //depot/perl@32559
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -4032,23 +4032,19 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) AV * const other_av = (AV *) SvRV(Other); const I32 other_len = av_len(other_av) + 1; I32 i; - - if (HvUSEDKEYS((HV *) This) != other_len) - RETPUSHNO; - - for(i = 0; i < other_len; ++i) { + + 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 happen? */ - RETPUSHNO; - - key = SvPV(*svp, key_len); - if(!hv_exists((HV *) This, key, key_len)) - RETPUSHNO; + if (svp) { /* ??? When can this not happen? */ + key = SvPV(*svp, key_len); + if (hv_exists((HV *) This, key, key_len)) + RETPUSHYES; + } } - RETPUSHYES; + RETPUSHNO; } else if (SM_OTHER_REGEX) { PMOP * const matcher = make_matcher(other_regex); |