diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2006-04-02 18:32:32 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2006-04-02 18:32:32 +0000 |
commit | e822a8b4da084c8fc1bfb08714a7b2fc24ae94be (patch) | |
tree | 5ff9b07a1051f9921e8af973e5dea33fd01408d9 /regexp.h | |
parent | cd9c531be513536b79fedbd4e62848ab287007d5 (diff) | |
download | perl-e822a8b4da084c8fc1bfb08714a7b2fc24ae94be.tar.gz |
make parts of struct regmatch_state unions
This reduces its size from 120 to 72 bytes
p4raw-id: //depot/perl@27685
Diffstat (limited to 'regexp.h')
-rw-r--r-- | regexp.h | 72 |
1 files changed, 53 insertions, 19 deletions
@@ -222,28 +222,62 @@ typedef struct { CURCUR *cc; /* current innermost curly struct */ char *locinput; - /* ... while the rest of these are local to an individual branch; - * thus they can be safely reused in other branches. */ + /* ... while the rest of these are local to an individual branch */ I32 n; /* no or next */ I32 ln; /* len or last */ - I32 c1, c2, paren; /* case fold search, parenth */ - CHECKPOINT cp; /* remember current savestack indexes */ - CHECKPOINT lastcp; - CURCUR *oldcc; /* tmp copy of cc */ - char *lastloc; /* Detection of 0-len. */ - I32 cache_offset; - I32 cache_bit; - I32 curlym_l; - I32 matches; - I32 maxwanted; - char *e; - char *old; - int count; - re_cc_state *cur_call_cc; - regexp *end_re; - reg_trie_accepted *accept_buff; - U32 accepted; /* how many accepting states we have seen */ + + union { + struct { + reg_trie_accepted *accept_buff; + U32 accepted; /* how many accepting states we have seen */ + } trie; + + struct { + CHECKPOINT cp; /* remember current savestack indexes */ + CHECKPOINT lastcp; + } eval; + + struct { + CHECKPOINT cp; /* remember current savestack indexes */ + CURCUR *savecc; + } curlyx; + + struct { + CHECKPOINT cp; /* remember current savestack indexes */ + CHECKPOINT lastcp; + CURCUR *savecc; + char *lastloc; /* Detection of 0-len. */ + I32 cache_offset; + I32 cache_bit; + } whilem; + + struct { + I32 paren; + I32 c1, c2; /* case fold search */ + CHECKPOINT lastcp; + I32 l; + I32 matches; + I32 maxwanted; + } curlym; + + struct { + I32 paren; + CHECKPOINT lastcp; + I32 c1, c2; /* case fold search */ + char *e; + char *old; + int count; + } plus; /* and CURLYN/CURLY/STAR */ + + struct { + CHECKPOINT cp; /* remember current savestack indexes */ + CHECKPOINT lastcp; + CURCUR *savecc; + re_cc_state *cur_call_cc; + regexp *end_re; + } end; + }; re_cc_state *reg_call_cc; /* saved value of PL_reg_call_cc */ } regmatch_state; |