diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-11-05 19:38:24 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-11-05 19:38:24 +0000 |
commit | 084916e3fc0f2b4a3c1f5c34365624111b26973e (patch) | |
tree | e263a30417b781c6d5db92d1577035f7ef25cc4c /pp_ctl.c | |
parent | 1cf6bcb82b487d8b46243d2e315539ffa9189b1f (diff) | |
download | perl-084916e3fc0f2b4a3c1f5c34365624111b26973e.tar.gz |
Fix for bug id 19990615.008, pos() unset during s///ge.
p4raw-id: //depot/perl@7562
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -211,6 +211,21 @@ PP(pp_substcont) cx->sb_m = m = rx->startp[0] + orig; sv_catpvn(dstr, s, m-s); cx->sb_s = rx->endp[0] + orig; + { /* Update the pos() information. */ + SV *sv = cx->sb_targ; + MAGIC *mg; + I32 i; + if (SvTYPE(sv) < SVt_PVMG) + SvUPGRADE(sv, SVt_PVMG); + if (!(mg = mg_find(sv, 'g'))) { + sv_magic(sv, Nullsv, 'g', Nullch, 0); + mg = mg_find(sv, 'g'); + } + i = m - orig; + if (DO_UTF8(sv)) + sv_pos_b2u(sv, &i); + mg->mg_len = i; + } cx->sb_rxtainted |= RX_MATCH_TAINTED(rx); rxres_save(&cx->sb_rxres, rx); RETURNOP(pm->op_pmreplstart); |