summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1996-02-03 12:43:39 -0500
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1996-02-03 12:43:39 -0500
commitc6496cc7fc2c48aca71f04ae322477979e67d744 (patch)
tree1fbd1e1ca1650a5504b0c54b9601b3e88f420e9b
parent01e8c204017179e3fa6cbc2de78a2b253e247445 (diff)
downloadperl-c6496cc7fc2c48aca71f04ae322477979e67d744.tar.gz
perl 5.002gamma: mg.c
>From salzench@dun.nielsen.comSat Feb 3 15:17:03 1996 >Date: Sat, 3 Feb 1996 12:43:39 -0500 (EST) >From: Chip Salzenberg <salzench@dun.nielsen.com> >Reply to: chip@atlantic.net >To: Perl 5 Porters <perl5-porters@africa.nicoh.com> >Subject: Beta3: Possible typo in sv_unmagic() [edited] >From salzench@dun.nielsen.comTue Feb 6 09:45:25 1996 >Date: Mon, 5 Feb 1996 00:09:09 -0500 (EST) >From: Chip Salzenberg <salzench@dun.nielsen.com> >Reply to: chip@atlantic.net >To: Perl 5 Porters <perl5-porters@africa.nicoh.com> >Subject: Beta3: Fix for 2nd magic SEGV >From lwall@sems.comWed Feb 7 09:10:55 1996 >Date: Tue, 06 Feb 96 14:52:41 -0800 >From: Larry Wall <lwall@sems.com> >To: perl5-porters@africa.nicoh.com >Subject: study still busted >The study itself work fine, but if you modify the string, it still thinks >it is studied. In some ways this is worse than study not working at all, >as it did (or rather didn't) before. Here's the test case:
-rw-r--r--mg.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index 1e37f4562a..9d69be5b79 100644
--- a/mg.c
+++ b/mg.c
@@ -98,17 +98,23 @@ SV* sv;
{
MGS* mgs;
MAGIC* mg;
+ MAGIC** mgp;
ENTER;
mgs = save_magic(sv);
- for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) {
+ mgp = &SvMAGIC(sv);
+ while ((mg = *mgp) != 0) {
MGVTBL* vtbl = mg->mg_virtual;
if (!(mg->mg_flags & MGf_GSKIP) && vtbl && vtbl->svt_get) {
(*vtbl->svt_get)(sv, mg);
- if (mg->mg_flags & MGf_GSKIP)
+ /* Ignore this magic if it's been deleted */
+ if (*mgp == mg && (mg->mg_flags & MGf_GSKIP))
mgs->mgs_flags = 0;
}
+ /* Advance to next magic (complicated by possible deletion) */
+ if (*mgp == mg)
+ mgp = &mg->mg_moremagic;
}
LEAVE;
@@ -992,6 +998,7 @@ SV* sv;
MAGIC* mg;
{
mg->mg_len = -1;
+ SvSCREAM_off(sv);
return 0;
}