develooper Front page | perl.perl5.porters | Postings from August 2001

RE: [PATCH List::Util] fix stack/scoping problems

Thread Previous | Thread Next
From:
Wilson, Doug
Date:
August 21, 2001 12:09
Subject:
RE: [PATCH List::Util] fix stack/scoping problems
Message ID:
35A280DF784CD411A06B0008C7B130ADB5510C@sdex04.sd.intuit.com

Cool, I tried to do the same thing with (PUSH|POP)BLOCK, but
I just didn't get the magic right :)

I know I'm probably living dangerously, but does anyone think
there'd be problems or significant benefit with only calling
(PUSH|POP)BLOCK once, rather than for each list element?
This seems to work also (from List::Util::first after applying
Robin's patch):

PUSHBLOCK(cx, CXt_BLOCK, SP);  # Added
for(index = 1 ; index < items ; index++) {
    GvSV(PL_defgv) = ST(index);
    PL_op = reducecop;
    #PUSHBLOCK(cx, CXt_BLOCK, SP); #Deleted
    CALLRUNOPS(aTHX);
    #POPBLOCK(cx,PL_curpm);     #Deleted
    SP = newsp;
    if (SvTRUE(*PL_stack_sp)) {
      POPBLOCK(cx,PL_curpm);  # Added
      ST(0) = ST(index);
      XSRETURN(1);
    }
}
POPBLOCK(cx,PL_curpm); # Added
XSRETURN_UNDEF;

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About