summaryrefslogtreecommitdiff
path: root/src/syntax.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-02-24 21:36:34 +0100
committerBram Moolenaar <Bram@vim.org>2018-02-24 21:36:34 +0100
commit36f923014a7eb7e24c4b0b88719cad14351e3a60 (patch)
tree514603715d87eab08c603e74149f79dc10a18362 /src/syntax.c
parent2b10bcbfc1c025bf7e6358326ee70105e7d30e96 (diff)
downloadvim-git-36f923014a7eb7e24c4b0b88719cad14351e3a60.tar.gz
patch 8.0.1541: synpat_T is taking too much memoryv8.0.1541
Problem: synpat_T is taking too much memory. Solution: Reorder members to reduce padding. (Dominique Pelle, closes #2671)
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/syntax.c b/src/syntax.c
index 79b2796d2..89941b625 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -145,30 +145,32 @@ static char *(spo_name_tab[SPO_COUNT]) =
*
* A character offset can be given for the matched text (_m_start and _m_end)
* and for the actually highlighted text (_h_start and _h_end).
+ *
+ * Note that ordering of members is optimized to reduce padding.
*/
typedef struct syn_pattern
{
char sp_type; /* see SPTYPE_ defines below */
char sp_syncing; /* this item used for syncing */
+ short sp_syn_match_id; /* highlight group ID of pattern */
+ short sp_off_flags; /* see below */
+ int sp_offsets[SPO_COUNT]; /* offsets */
int sp_flags; /* see HL_ defines below */
#ifdef FEAT_CONCEAL
int sp_cchar; /* conceal substitute character */
#endif
+ int sp_ic; /* ignore-case flag for sp_prog */
+ int sp_sync_idx; /* sync item index (syncing only) */
+ int sp_line_id; /* ID of last line where tried */
+ int sp_startcol; /* next match in sp_line_id line */
+ short *sp_cont_list; /* cont. group IDs, if non-zero */
+ short *sp_next_list; /* next group IDs, if non-zero */
struct sp_syn sp_syn; /* struct passed to in_id_list() */
- short sp_syn_match_id; /* highlight group ID of pattern */
char_u *sp_pattern; /* regexp to match, pattern */
regprog_T *sp_prog; /* regexp to match, program */
#ifdef FEAT_PROFILE
syn_time_T sp_time;
#endif
- int sp_ic; /* ignore-case flag for sp_prog */
- short sp_off_flags; /* see below */
- int sp_offsets[SPO_COUNT]; /* offsets */
- short *sp_cont_list; /* cont. group IDs, if non-zero */
- short *sp_next_list; /* next group IDs, if non-zero */
- int sp_sync_idx; /* sync item index (syncing only) */
- int sp_line_id; /* ID of last line where tried */
- int sp_startcol; /* next match in sp_line_id line */
} synpat_T;
/* The sp_off_flags are computed like this: