From 0610fc509ae2826140209bbcd3efe5003d132f51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 22 May 2017 16:12:55 +0200
Subject: [PATCH] Fix building on Perl 5.25.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
v5.25.0-71-g5d32d26 enabled PERL_OP_PARENT and that changed op_sibling
semantics for last sibling OP.
This patch implements a fix as recommended in
<
https://rt.perl.org/Public/Bug/Display.html?id=128179#txn-1405910>.
It also bundles ppport.h
CPAN RT#117385
Signed-off-by: Petr PÃsaÅ <ppisar@redhat.com>
---
lib/Array/Base.xs | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/lib/Array/Base.xs b/lib/Array/Base.xs
index 91bc7b5..13db507 100644
--- a/lib/Array/Base.xs
+++ b/lib/Array/Base.xs
@@ -2,6 +2,7 @@
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
+#include "ppport.h"
#define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#define PERL_DECIMAL_VERSION \
@@ -92,13 +93,12 @@ static OP *myck_aelem(pTHX_ OP *op)
croak("strange op tree prevents applying array base");
}
aop = cBINOPx(op)->op_first;
- iop = aop->op_sibling;
- if(!iop || iop->op_sibling) goto bad_ops;
- aop->op_sibling =
- op_contextualize(
+ iop = OpSIBLING(aop);
+ if(!iop || OpHAS_SIBLING(iop)) goto bad_ops;
+ OpMAYBESIB_set(aop, op_contextualize(
newBINOP(OP_I_SUBTRACT, 0, iop,
newSVOP(OP_CONST, 0, newSViv(base))),
- G_SCALAR);
+ G_SCALAR), op);
}
return nxck_aelem(aTHX_ op);
}
@@ -114,12 +114,12 @@ static OP *THX_base_myck_slice(pTHX_ OP *op, OP *(*nxck)(pTHX_ OP *o))
croak("strange op tree prevents applying array base");
}
lop = cLISTOPx(op)->op_first;
- aop = lop->op_sibling;
- if(!aop || aop->op_sibling) goto bad_ops;
- lop->op_sibling = NULL;
+ aop = OpSIBLING(lop);
+ if(!aop || OpHAS_SIBLING(aop)) goto bad_ops;
+ OpLASTSIB_set(lop, op);
mop = op_contextualize(mapify_op(lop, base, OP_I_SUBTRACT),
G_ARRAY);
- mop->op_sibling = aop;
+ OpMAYBESIB_set(mop, aop, op);
cLISTOPx(op)->op_first = mop;
}
return nxck(aTHX_ op);
@@ -156,17 +156,17 @@ static OP *myck_splice(pTHX_ OP *op)
}
pop = cLISTOPx(op)->op_first;
if(pop->op_type != OP_PUSHMARK) goto bad_ops;
- aop = pop->op_sibling;
+ aop = OpSIBLING(pop);
if(!aop) goto bad_ops;
- iop = aop->op_sibling;
+ iop = OpSIBLING(aop);
if(iop) {
- OP *rest = iop->op_sibling;
- iop->op_sibling = NULL;
+ OP *rest = OpSIBLING(iop);
+ OpLASTSIB_set(iop, op);
iop = newBINOP(OP_I_SUBTRACT, 0,
op_contextualize(iop, G_SCALAR),
newSVOP(OP_CONST, 0, newSViv(base)));
- iop->op_sibling = rest;
- aop->op_sibling = iop;
+ OpMAYBESIB_set(iop, rest, op);
+ OpMAYBESIB_set(aop, iop, op);
}
}
return nxck_splice(aTHX_ op);
--
2.9.4