summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-03-17 15:34:24 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-03-17 15:34:24 +0100
commit168ff818262576c8ec771f99cf50b7095a83e10c (patch)
tree7d7f80fecbc6e55f998f7b6a5a7359d07aa082ed /pp_ctl.c
parent203d1e89388de309200a88815a95943bd5b59d86 (diff)
downloadperl-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.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 0b172c55ed..1b4bbf5133 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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;