summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-06-16 14:34:14 +0100
committerDavid Mitchell <davem@iabyn.com>2014-07-08 16:40:03 +0100
commit3253bf854af27f38b67fb3a8dfeee758885f3ae9 (patch)
tree9aac72f516a0892094fdcfda8f56b9cdbd7e1bbd /proto.h
parente864b323d8621840aac1fda03b2bf69dba6336ff (diff)
downloadperl-3253bf854af27f38b67fb3a8dfeee758885f3ae9.tar.gz
add op_sibling_splice() fn and make core use it
The op_sibling_splice() is a new general-purpose OP manipulation function designed to edit the children of an op, in an analogous manner in which the perl splice() function manipulates arrays. This commit also edits op.c and a few other places to remove most direct manipulation of op_sibling, op_first and op_last, and replace that with calls to op_sibling_splice(). This has two advantages. First, by using the one function consistently throughout, it makes it clearer what a particular piece of of code is doing, rather than having to decipher lots of of ad-hoc cLISTOPo->op_first = OP_SIBLING(kid); style stuff. Second, it will make it easier to later add a facility for child OPs to find their parent, since the changes now only need to be made in a few places. In theory this commit should make no functional change to the code.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 46c41bce96..de11c62b3f 100644
--- a/proto.h
+++ b/proto.h
@@ -3125,6 +3125,11 @@ PERL_CALLCONV OP* Perl_op_prepend_elem(pTHX_ I32 optype, OP* first, OP* last);
PERL_CALLCONV void Perl_op_refcnt_lock(pTHX);
PERL_CALLCONV void Perl_op_refcnt_unlock(pTHX);
PERL_CALLCONV OP* Perl_op_scope(pTHX_ OP* o);
+PERL_CALLCONV OP* Perl_op_sibling_splice(pTHX_ OP *parent, OP *start, int del_count, OP* insert)
+ __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_OP_SIBLING_SPLICE \
+ assert(parent)
+
PERL_CALLCONV OP* Perl_op_unscope(pTHX_ OP* o);
PERL_CALLCONV void Perl_pack_cat(pTHX_ SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags)
__attribute__nonnull__(pTHX_1)