This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.h: Create FILL_NODE macro and use it
authorKarl Williamson <khw@cpan.org>
Thu, 20 Sep 2018 15:44:21 +0000 (09:44 -0600)
committerKarl Williamson <khw@cpan.org>
Sat, 20 Oct 2018 06:09:54 +0000 (00:09 -0600)
This is a more fundamental operation than the pre-existing
FILL_ADVANCE_NODE, which is changed to use this for the portion that
fills the node but doesn't advance the pointer.

regcomp.c
regcomp.h

index 06e0478..d1f86c3 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -19332,7 +19332,7 @@ S_reginsert(pTHX_ RExC_state_t *pRExC_state, U8 op, regnode *operand, U32 depth)
 #endif
     src = NEXTOPER(place);
     place->flags = 0;
-    FILL_ADVANCE_NODE(place, op);
+    FILL_NODE(place, op);
     Zero(src, offset, regnode);
 }
 
index 0c52226..b7cbe6b 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -353,8 +353,16 @@ struct regnode_ssc {
 #define        NEXTOPER(p)     ((p) + NODE_STEP_REGNODE)
 #define        PREVOPER(p)     ((p) - NODE_STEP_REGNODE)
 
-#define FILL_ADVANCE_NODE(ptr, op) STMT_START { \
-    (ptr)->type = op;    (ptr)->next_off = 0;   (ptr)++; } STMT_END
+#define FILL_NODE(ptr, op)                                           \
+    STMT_START {                                                     \
+                    OP(ptr) = op;                                    \
+                    NEXT_OFF(ptr) = 0;                               \
+    } STMT_END
+#define FILL_ADVANCE_NODE(ptr, op)                                   \
+    STMT_START {                                                     \
+                    FILL_NODE(ptr, op);                              \
+                    (ptr)++;                                         \
+    } STMT_END
 #define FILL_ADVANCE_NODE_ARG(ptr, op, arg) STMT_START { \
     ARG_SET(ptr, arg);  FILL_ADVANCE_NODE(ptr, op); (ptr) += 1; } STMT_END
 #define FILL_ADVANCE_NODE_2L_ARG(ptr, op, arg1, arg2)               \