diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-03-17 15:34:24 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-03-17 15:34:24 +0100 |
commit | 168ff818262576c8ec771f99cf50b7095a83e10c (patch) | |
tree | 7d7f80fecbc6e55f998f7b6a5a7359d07aa082ed /pp_ctl.c | |
parent | 203d1e89388de309200a88815a95943bd5b59d86 (diff) | |
download | perl-168ff818262576c8ec771f99cf50b7095a83e10c.tar.gz |
Document that empty sets don't smart-match
(and implement this for the C<~~ coderef> form)
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -4091,7 +4091,9 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) HE *he; bool andedresults = TRUE; HV *hv = (HV*) SvRV(d); - (void) hv_iterinit(hv); + I32 numkeys = hv_iterinit(hv); + if (numkeys == 0) + RETPUSHNO; while ( (he = hv_iternext(hv)) ) { ENTER; SAVETMPS; @@ -4118,6 +4120,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other) bool andedresults = TRUE; AV *av = (AV*) SvRV(d); const I32 len = av_len(av); + if (len == -1) + RETPUSHNO; for (i = 0; i <= len; ++i) { SV * const * const svp = av_fetch(av, i, FALSE); ENTER; |