From 44eb4cdc274114db740861e4a116ffce3371d70f Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Tue, 21 Mar 2023 22:02:48 +0100 Subject: regcomp.h - use a common union for head and args across all regnodes. This helps with HPUX builds where we need to ensure everything is aligned the same (on 32 bit boundaries). It also strongly encourages everything to use the accessor macros and not access the members directly. By using a union for the variadic fields we make it more obvious that some regops use the field in different ways. This patch also converts all the arg unions into a standardized union with standardized member names. --- regexp.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'regexp.h') diff --git a/regexp.h b/regexp.h index d3269ad18c..243cf246c6 100644 --- a/regexp.h +++ b/regexp.h @@ -29,10 +29,23 @@ struct regnode_meta { U8 off_by_arg; }; +/* this ensures that on alignment sensitive platforms + * this struct is aligned on 32 bit boundaries */ +union regnode_head { + struct { + union { + U8 flags; + U8 str_len_u8; + U8 first_byte; + } u_8; + U8 type; + U16 next_off; + } data; + U32 data_u32; +}; + struct regnode { - U8 flags; - U8 type; - U16 next_off; + union regnode_head head; }; typedef struct regnode regnode; -- cgit v1.2.1