develooper Front page | perl.perl5.changes | Postings from September 2019

[perl.git] branch smoke-me/khw-lexact updated.v5.31.3-190-g9416765c51

From:
Karl Williamson
Date:
September 18, 2019 16:49
Subject:
[perl.git] branch smoke-me/khw-lexact updated.v5.31.3-190-g9416765c51
Message ID:
E1iAd8s-0001TA-DZ@git.dc.perl.space
In perl.git, the branch smoke-me/khw-lexact has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/9416765c517188b87db391d4baecb4ac4895b516?hp=0815f5d3102b0250013fcb8f47623a7aad9de645>

- Log -----------------------------------------------------------------
commit 9416765c517188b87db391d4baecb4ac4895b516
Author: Karl Williamson <khw@cpan.org>
Date:   Wed Sep 18 10:49:13 2019 -0600

    f

-----------------------------------------------------------------------

Summary of changes:
 regcomp.h | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/regcomp.h b/regcomp.h
index 82240292eb..d0292d3db8 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -156,6 +156,14 @@ struct regnode_string {
     char string[1];
 };
 
+struct regnode_lstring { /* Constructed this way to keep the string aligned. */
+    U8	flags;
+    U8  type;
+    U16 next_off;
+    U32 str_len;    /* Only 16 bits allowed before would overflow 'next_off' */
+    char string[1];
+};
+
 /* Argument bearing node - workhorse, 
    arg1 is often for the data field */
 struct regnode_1 {
@@ -335,22 +343,23 @@ struct regnode_ssc {
 #define	STRINGs(p)	(__ASSERT_(OP(p) != LEXACT) ((struct regnode_string *)p)->string)
 #define	OPERANDs(p)	STRINGs(p)
 
-#define	STR_LENl(p)	(__ASSERT_(OP(p) == LEXACT) (U16)((((struct regnode_string *)p)->str_len) | ((((struct regnode_string *)p)->string[0]) << 8)))
-#define	STRINGl(p)	(__ASSERT_(OP(p) == LEXACT) (((struct regnode_string *)p)->string) + 1)
+#define	STR_LENl(p)	(__ASSERT_(OP(p) == LEXACT) (((struct regnode_lstring *)p)->str_len))
+#define	STRINGl(p)	(__ASSERT_(OP(p) == LEXACT) (((struct regnode_lstring *)p)->string))
 #define	OPERANDl(p)	STRINGl(p)
 
-#define	OPERAND(p)	((OP(p) == LEXACT) ? OPERANDl(p) : OPERANDs(p))
 #define	STR_LEN(p)	((OP(p) == LEXACT) ? STR_LENl(p) : STR_LENs(p))
 #define	STRING(p)	((OP(p) == LEXACT) ? STRINGl(p)  : STRINGs(p))
+#define	OPERAND(p)	STRING(p)
 
 #define MASK(p)		((char*)OPERAND(p))
 #define STR_SZ(l)	(((l) + sizeof(regnode) - 1) / sizeof(regnode))
 #define NODE_SZ_STR(p)	(STR_SZ(STR_LEN(p))+1)
 #define setSTR_LEN(p,v)                                                     \
     STMT_START{                                                             \
-        ((struct regnode_string *)p)->str_len = ((v) & 0xFF);               \
         if (OP(p) == LEXACT)                                                \
-            ((struct regnode_string *)p)->string[0] = ((v) >> 8);           \
+            ((struct regnode_lstring *)(p))->str_len = (v);                 \
+        else                                                                \
+            ((struct regnode_string *)(p))->str_len = (v);                  \
     } STMT_END
 
 #undef NODE_ALIGN

-- 
Perl5 Master Repository



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About