summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJeff Pinyan <japhy@pobox.com>2001-07-27 10:00:37 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-07-29 16:28:45 +0000
commit6de678708ca27d8ff9604030551fb53b27f5c5be (patch)
treea26575b52846895de3b65d8cee0b1ca6e83d41b4 /pp.c
parent0926d669f0aeb90483227aeb54b96aaa4edee0f3 (diff)
downloadperl-6de678708ca27d8ff9604030551fb53b27f5c5be.tar.gz
split()'s unused captures should be undef, not ''
Message-ID: <Pine.GSO.4.21.0107271358310.28213-100000@crusoe.crusoe.net> p4raw-id: //depot/perl@11475
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 51e10def89..658a89042a 100644
--- a/pp.c
+++ b/pp.c
@@ -4228,12 +4228,16 @@ PP(pp_split)
for (i = 1; i <= rx->nparens; i++) {
s = rx->startp[i] + orig;
m = rx->endp[i] + orig;
- if (m && s) {
+
+ /* japhy (07/27/01) -- the (m && s) test doesn't catch
+ parens that didn't match -- they should be set to
+ undef, not the empty string */
+ if (m >= orig && s >= orig) {
dstr = NEWSV(33, m-s);
sv_setpvn(dstr, s, m-s);
}
else
- dstr = NEWSV(33, 0);
+ dstr = &PL_sv_undef; /* undef, not "" */
if (make_mortal)
sv_2mortal(dstr);
if (do_utf8)