From 1ea34a4b9664a7c2b95e9fa15c08471b27523fcb Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Mon, 6 Jun 2022 13:12:41 +0100 Subject: 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. --- op.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'op.h') 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 -- cgit v1.2.1