summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1997-04-04 00:00:00 +0000
committerChip Salzenberg <chip@atlantic.net>1997-04-04 00:00:00 +0000
commit5cd24f17b72b10f8506d70fba1ec4dd25224c257 (patch)
tree0016ef5cb000e60fd3ea5ca5acf14ab3fa5a9812 /pp_hot.c
parentdaff0e373f3630eaa9dbded0adcc04185f454487 (diff)
downloadperl-5cd24f17b72b10f8506d70fba1ec4dd25224c257.tar.gz
[inseparable changes from match from perl-5.003_97a to perl-5.003_97b]
BUILD PROCESS Subject: Don't suggest 'Configure -der' in config.sh comments From: Chip Salzenberg <chip@perl.com> Files: Configure CORE LANGUAGE CHANGES Subject: Make assignment to C<$)> call setgroups() From: Chip Salzenberg <chip@perl.com> Files: Configure config_H config_h.SH mg.c plan9/config.plan9 pod/perldelta.pod vms/config.vms win32/config.H win32/config.w32 Subject: Grandfather "$$<digit>" in strings From: Chip Salzenberg <chip@perl.com> Files: pod/perldiag.pod toke.c Subject: Disconnect warn and die hooks _after_ object destruction From: Chip Salzenberg <chip@perl.com> Files: perl.c Subject: Forbid recursive substitutions From: Chip Salzenberg <chip@perl.com> Files: cop.h pod/perldelta.pod pod/perldiag.pod pp_ctl.c pp_hot.c DOCUMENTATION Subject: Document required module versions From: Chip Salzenberg <chip@perl.com> Files: pod/perldelta.pod LIBRARY AND EXTENSIONS Subject: Updates to Math::Complex and Math::Trig From: Jarkko Hietaniemi <Jarkko.Hietaniemi@cc.hut.fi> Files: lib/Math/Complex.pm lib/Math/Trig.pm pod/perldelta.pod t/lib/complex.t OTHER CORE CHANGES Subject: length($') isn't Date: Mon, 07 Apr 1997 03:30:44 -0400 From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: mg.c Msg-ID: 199704070730.DAA07310@aatma.engin.umich.edu (applied based on p5p patch as commit 645a7cbb1f14932f058231f0a4f808b88ebe8703) Subject: Fix obscure regex bug related to leading C<.*> From: Chip Salzenberg <chip@perl.com> Files: toke.c Subject: Add warning for glob failure From: Chip Salzenberg <chip@perl.com> Files: pod/perldelta.pod pod/perldiag.pod pp_hot.c Subject: Fix C<perl -V> in presence of local patches From: Chip Salzenberg <chip@perl.com> Files: perl.c
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 2f735a3bf6..0422017d74 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1171,7 +1171,8 @@ do_readline()
IoFLAGS(io) |= IOf_START;
}
else if (type == OP_GLOB) {
- (void)do_close(last_in_gv, FALSE);
+ if (do_close(last_in_gv, FALSE) & ~0xFF)
+ warn("internal error: glob failed");
}
if (gimme == G_SCALAR) {
(void)SvOK_off(TARG);
@@ -1386,6 +1387,13 @@ PP(pp_iter)
RETPUSHYES;
}
+static void
+leave_subst(p)
+void *p;
+{
+ ((PMOP*)p)->op_private &= ~OPpLVAL_INTRO;
+}
+
PP(pp_subst)
{
dSP; dTARG;
@@ -1410,8 +1418,8 @@ PP(pp_subst)
int force_on_match = 0;
I32 oldsave = savestack_ix;
- if (pm->op_pmflags & PMf_CONST) /* known replacement string? */
- dstr = POPs;
+ /* known replacement string? */
+ dstr = (pm->op_pmflags & PMf_CONST) ? POPs : Nullsv;
if (op->op_flags & OPf_STACKED)
TARG = POPs;
else {
@@ -1427,6 +1435,13 @@ PP(pp_subst)
force_on_match = 1;
TAINT_NOT;
+ if (pm->op_private & OPpLVAL_INTRO)
+ croak("Recursive substitution detected");
+ if (!dstr) {
+ SAVEDESTRUCTOR(leave_subst, pm);
+ pm->op_private |= OPpLVAL_INTRO;
+ }
+
force_it:
if (!pm || !s)
DIE("panic: do_subst");
@@ -1480,7 +1495,7 @@ PP(pp_subst)
once = !(rpm->op_pmflags & PMf_GLOBAL);
/* known replacement string? */
- c = (rpm->op_pmflags & PMf_CONST) ? SvPV(dstr, clen) : Nullch;
+ c = dstr ? SvPV(dstr, clen) : Nullch;
/* can do inplace substitution? */
if (c && clen <= rx->minlen) {
@@ -1630,13 +1645,12 @@ PP(pp_subst)
LEAVE_SCOPE(oldsave);
RETURN;
}
-
- PUSHs(&sv_no);
- LEAVE_SCOPE(oldsave);
- RETURN;
+ goto ret_no;
nope:
++BmUSEFUL(pm->op_pmshort);
+
+ret_no:
PUSHs(&sv_no);
LEAVE_SCOPE(oldsave);
RETURN;