summaryrefslogtreecommitdiff
path: root/ext/List
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2002-10-18 14:36:40 +0100
committerhv <hv@crypt.org>2002-10-22 17:04:26 +0000
commitf3548bdc4d2efd11e139d110e60764b9dae81319 (patch)
tree422946e9b45718c9b89294215cd0ce41c7e258ea /ext/List
parente0fa987931295419ee9237d08014c4c5381f1cf8 (diff)
downloadperl-f3548bdc4d2efd11e139d110e60764b9dae81319.tar.gz
PL_curpad == AvARRAY(PL_comppad) always
Message-ID: <20021018133640.A19172@fdgroup.com> p4raw-id: //depot/perl@18048
Diffstat (limited to 'ext/List')
-rw-r--r--ext/List/Util/Util.xs16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/List/Util/Util.xs b/ext/List/Util/Util.xs
index 92ee08499e..c26c484057 100644
--- a/ext/List/Util/Util.xs
+++ b/ext/List/Util/Util.xs
@@ -212,8 +212,12 @@ CODE:
reducecop = CvSTART(cv);
SAVESPTR(CvROOT(cv)->op_ppaddr);
CvROOT(cv)->op_ppaddr = PL_ppaddr[OP_NULL];
+#ifdef PAD_SET_CUR
+ PAD_SET_CUR(CvPADLIST(cv),1);
+#else
SAVESPTR(PL_curpad);
PL_curpad = AvARRAY((AV*)AvARRAY(CvPADLIST(cv))[1]);
+#endif
SAVETMPS;
SAVESPTR(PL_op);
ret = ST(1);
@@ -256,8 +260,12 @@ CODE:
reducecop = CvSTART(cv);
SAVESPTR(CvROOT(cv)->op_ppaddr);
CvROOT(cv)->op_ppaddr = PL_ppaddr[OP_NULL];
+#ifdef PAD_SET_CUR
+ PAD_SET_CUR(CvPADLIST(cv),1);
+#else
SAVESPTR(PL_curpad);
PL_curpad = AvARRAY((AV*)AvARRAY(CvPADLIST(cv))[1]);
+#endif
SAVETMPS;
SAVESPTR(PL_op);
CATCH_SET(TRUE);
@@ -286,20 +294,16 @@ CODE:
int index;
struct op dmy_op;
struct op *old_op = PL_op;
- SV *my_pad[2];
- SV **old_curpad = PL_curpad;
/* We call pp_rand here so that Drand01 get initialized if rand()
or srand() has not already been called
*/
- my_pad[1] = sv_newmortal();
memzero((char*)(&dmy_op), sizeof(struct op));
- dmy_op.op_targ = 1;
+ /* we let pp_rand() borrow the TARG allocated for this XS sub */
+ dmy_op.op_targ = PL_op->op_targ;
PL_op = &dmy_op;
- PL_curpad = (SV **)&my_pad;
(void)*(PL_ppaddr[OP_RAND])(aTHX);
PL_op = old_op;
- PL_curpad = old_curpad;
for (index = items ; index > 1 ; ) {
int swap = (int)(Drand01() * (double)(index--));
SV *tmp = ST(swap);