summaryrefslogtreecommitdiff
path: root/op.h
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2022-06-06 13:12:41 +0100
committerPaul Evans <leonerd@leonerd.org.uk>2022-06-20 13:36:52 +0100
commit1ea34a4b9664a7c2b95e9fa15c08471b27523fcb (patch)
tree8ebed375f5fd620214c02bee8f640b94b0947e93 /op.h
parent2c8b8b71354d7e18c0d1992c4e3aca061831a93a (diff)
downloadperl-1ea34a4b9664a7c2b95e9fa15c08471b27523fcb.tar.gz
Move the handy OpTYPE_set() macro out of op.c into op.h where other code can see it
Also defend it against side-effects in arguments, by allocating temporary variables.
Diffstat (limited to 'op.h')
-rw-r--r--op.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/op.h b/op.h
index 63be5433da..394ce2579a 100644
--- a/op.h
+++ b/op.h
@@ -64,6 +64,14 @@ typedef PERL_BITFIELD16 Optype;
U8 op_private;
#endif
+#define OpTYPE_set(o,type) \
+ STMT_START { \
+ OP *o_ = (OP *)o; \
+ OPCODE type_ = type; \
+ o_->op_type = type_; \
+ o_->op_ppaddr = PL_ppaddr[type_]; \
+ } STMT_END
+
/* If op_type:9 is changed to :10, also change cx_pusheval()
Also, if the type of op_type is ever changed (e.g. to PERL_BITFIELD32)
then all the other bit-fields before/after it should change their