0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.1541: synpat_T is taking too much memory

Problem:    synpat_T is taking too much memory.
Solution:   Reorder members to reduce padding. (Dominique Pelle, closes #2671)
This commit is contained in:
Bram Moolenaar
2018-02-24 21:36:34 +01:00
parent 2b10bcbfc1
commit 36f923014a
2 changed files with 13 additions and 9 deletions

View File

@@ -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) * 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). * 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 typedef struct syn_pattern
{ {
char sp_type; /* see SPTYPE_ defines below */ char sp_type; /* see SPTYPE_ defines below */
char sp_syncing; /* this item used for syncing */ 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 */ int sp_flags; /* see HL_ defines below */
#ifdef FEAT_CONCEAL #ifdef FEAT_CONCEAL
int sp_cchar; /* conceal substitute character */ int sp_cchar; /* conceal substitute character */
#endif #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() */ 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 */ char_u *sp_pattern; /* regexp to match, pattern */
regprog_T *sp_prog; /* regexp to match, program */ regprog_T *sp_prog; /* regexp to match, program */
#ifdef FEAT_PROFILE #ifdef FEAT_PROFILE
syn_time_T sp_time; syn_time_T sp_time;
#endif #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; } synpat_T;
/* The sp_off_flags are computed like this: /* The sp_off_flags are computed like this:

View File

@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1541,
/**/ /**/
1540, 1540,
/**/ /**/