summaryrefslogtreecommitdiff
path: root/pp_sort.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-06-10 13:54:13 +0100
committerDavid Mitchell <davem@iabyn.com>2014-07-08 16:40:03 +0100
commit1ed44841e79d19d36361c250aecabc75154c999c (patch)
treefe39d432a2af6a50d6817d6747dd70fcfb3b21f4 /pp_sort.c
parent26443f8e448912975ced96860e4f51a9e1fbbaca (diff)
downloadperl-1ed44841e79d19d36361c250aecabc75154c999c.tar.gz
wrap op_sibling field access in OP_SIBLING* macros
Remove (almost all) direct access to the op_sibling field of OP structs, and use these three new macros instead: OP_SIBLING(o); OP_HAS_SIBLING(o); OP_SIBLING_set(o, new_value); OP_HAS_SIBLING is intended to be a slightly more efficient version of OP_SIBLING when only boolean context is needed. For now these three macros are just defined in the obvious way: #define OP_SIBLING(o) (0 + (o)->op_sibling) #define OP_HAS_SIBLING(o) (cBOOL((o)->op_sibling)) #define OP_SIBLING_set(o, sib) ((o)->op_sibling = (sib)) but abstracting them out will allow us shortly to make the last pointer in an op_sibling chain point back to the parent rather than being null, with a new flag indicating whether this is the last op. Perl_ck_fun() still has a couple of direct uses of op_sibling, since it takes the field's address, which is not covered by these macros.
Diffstat (limited to 'pp_sort.c')
-rw-r--r--pp_sort.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp_sort.c b/pp_sort.c
index e205201968..f75ecd9f03 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1507,7 +1507,7 @@ PP(pp_sort)
SAVEVPTR(PL_sortcop);
if (flags & OPf_STACKED) {
if (flags & OPf_SPECIAL) {
- OP *nullop = cLISTOP->op_first->op_sibling; /* pass pushmark */
+ OP *nullop = OP_SIBLING(cLISTOP->op_first); /* pass pushmark */
assert(nullop->op_type == OP_NULL);
PL_sortcop = nullop->op_next;
}