summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2001-10-10 19:23:44 +0200
committerAbhijit Menon-Sen <ams@wiw.org>2001-10-10 14:49:43 +0000
commit8e5e9ebe73253381295c8c22fd24720255d732e9 (patch)
treeaf776933651524f9a51e600df3dcc23e2b74498e /regexec.c
parent737c380eddfcfb819f42666b6b5bd6171d245f53 (diff)
downloadperl-8e5e9ebe73253381295c8c22fd24720255d732e9.tar.gz
two s/// bugfixes
Message-Id: <20011010172344.C22440@rafael> p4raw-id: //depot/perl@12392
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/regexec.c b/regexec.c
index 58a7808d47..d65d70c916 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2536,11 +2536,18 @@ S_regmatch(pTHX_ regnode *prog)
PL_curpad = AvARRAY((AV*)PL_regdata->data[n + 2]);
PL_regendp[0] = PL_reg_magic->mg_len = locinput - PL_bostr;
- CALLRUNOPS(aTHX); /* Scalar context. */
- SPAGAIN;
- ret = POPs;
- PUTBACK;
-
+ {
+ SV **before = SP;
+ CALLRUNOPS(aTHX); /* Scalar context. */
+ SPAGAIN;
+ if (SP == before)
+ ret = Nullsv; /* protect against empty (?{}) blocks. */
+ else {
+ ret = POPs;
+ PUTBACK;
+ }
+ }
+
PL_op = oop;
PL_curpad = ocurpad;
PL_curcop = ocurcop;