aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-06 17:09:06 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-06 17:30:47 -0500
commitbea99729dd66a1d3c5351cbe6a7677df0619a33f (patch)
tree2beaf5430e075a93be4543394b2eec924c8830c9
parent336eb70822970cea6797251043158ee6bd76bc69 (diff)
downloadrneovim-bea99729dd66a1d3c5351cbe6a7677df0619a33f.tar.gz
rneovim-bea99729dd66a1d3c5351cbe6a7677df0619a33f.tar.bz2
rneovim-bea99729dd66a1d3c5351cbe6a7677df0619a33f.zip
vim-patch:8.1.2285: padding in structures wastes memory
Problem: Padding in structures wastes memory. Solution: Move fields to avoid padding. (Dominique Pelle, closes vim/vim#5202) https://github.com/vim/vim/commit/d6beab0248cdb0b7073e97d98d65de7138cb3386 Skip "ml_line_len" member of "struct memline". Patch v8.1.0579 was not ported.
-rw-r--r--src/nvim/buffer_defs.h14
-rw-r--r--src/nvim/eval.h2
-rw-r--r--src/nvim/ex_cmds_defs.h4
-rw-r--r--src/nvim/memline_defs.h8
-rw-r--r--src/nvim/sign_defs.h4
5 files changed, 15 insertions, 17 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index cc09b7e989..360616609c 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -296,13 +296,11 @@ typedef struct arglist {
int id; ///< id of this arglist
} alist_T;
-/*
- * For each argument remember the file name as it was given, and the buffer
- * number that contains the expanded file name (required for when ":cd" is
- * used.
- *
- * TODO: move aentry_T to another header
- */
+// For each argument remember the file name as it was given, and the buffer
+// number that contains the expanded file name (required for when ":cd" is
+// used).
+//
+// TODO(Felipe): move aentry_T to another header
typedef struct argentry {
char_u *ae_fname; // file name as specified
int ae_fnum; // buffer number with expanded file name
@@ -1036,10 +1034,10 @@ struct matchitem {
int id; ///< match ID
int priority; ///< match priority
char_u *pattern; ///< pattern to highlight
- int hlg_id; ///< highlight group ID
regmmatch_T match; ///< regexp program for pattern
posmatch_T pos; ///< position matches
match_T hl; ///< struct for doing the actual highlighting
+ int hlg_id; ///< highlight group ID
int conceal_char; ///< cchar for Conceal highlighting
};
diff --git a/src/nvim/eval.h b/src/nvim/eval.h
index 06b7f9e21d..a005d89cd0 100644
--- a/src/nvim/eval.h
+++ b/src/nvim/eval.h
@@ -57,9 +57,9 @@ typedef struct lval_S {
listitem_T *ll_li; ///< The list item or NULL.
list_T *ll_list; ///< The list or NULL.
int ll_range; ///< TRUE when a [i:j] range was used.
+ int ll_empty2; ///< Second index is empty: [i:].
long ll_n1; ///< First index for list.
long ll_n2; ///< Second index for list range.
- int ll_empty2; ///< Second index is empty: [i:].
dict_T *ll_dict; ///< The Dictionary or NULL.
dictitem_T *ll_di; ///< The dictitem or NULL.
char_u *ll_newkey; ///< New key for Dict in allocated memory or NULL.
diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h
index ca84d375ce..f928c61ea4 100644
--- a/src/nvim/ex_cmds_defs.h
+++ b/src/nvim/ex_cmds_defs.h
@@ -188,8 +188,8 @@ struct exarg {
// used for completion on the command line
struct expand {
- int xp_context; // type of expansion
char_u *xp_pattern; // start of item to expand
+ int xp_context; // type of expansion
size_t xp_pattern_len; // bytes in xp_pattern before cursor
char_u *xp_arg; // completion function
sctx_T xp_script_ctx; // SCTX for completion function
@@ -199,9 +199,9 @@ struct expand {
// characters need to be escaped
#endif
int xp_numfiles; // number of files found by file name completion
+ int xp_col; // cursor position in line
char_u **xp_files; // list of files
char_u *xp_line; // text being completed
- int xp_col; // cursor position in line
};
// values for xp_backslash
diff --git a/src/nvim/memline_defs.h b/src/nvim/memline_defs.h
index 9a6f29a908..dc4755f83d 100644
--- a/src/nvim/memline_defs.h
+++ b/src/nvim/memline_defs.h
@@ -45,16 +45,16 @@ typedef struct memline {
memfile_T *ml_mfp; // pointer to associated memfile
+ infoptr_T *ml_stack; // stack of pointer blocks (array of IPTRs)
+ int ml_stack_top; // current top of ml_stack
+ int ml_stack_size; // total number of entries in ml_stack
+
#define ML_EMPTY 1 // empty buffer
#define ML_LINE_DIRTY 2 // cached line was changed and allocated
#define ML_LOCKED_DIRTY 4 // ml_locked was changed
#define ML_LOCKED_POS 8 // ml_locked needs positive block number
int ml_flags;
- infoptr_T *ml_stack; // stack of pointer blocks (array of IPTRs)
- int ml_stack_top; // current top of ml_stack
- int ml_stack_size; // total number of entries in ml_stack
-
linenr_T ml_line_lnum; // line number of cached line, 0 if not valid
char_u *ml_line_ptr; // pointer to cached line
size_t ml_line_offset; // cached byte offset of ml_line_lnum
diff --git a/src/nvim/sign_defs.h b/src/nvim/sign_defs.h
index c898dba890..19c0263cf1 100644
--- a/src/nvim/sign_defs.h
+++ b/src/nvim/sign_defs.h
@@ -24,11 +24,11 @@ typedef struct signlist signlist_T;
struct signlist
{
int id; // unique identifier for each placed sign
- linenr_T lnum; // line number which has this sign
int typenr; // typenr of sign
+ int priority; // priority for highlighting
bool has_text_or_icon; // has text or icon
+ linenr_T lnum; // line number which has this sign
signgroup_T *group; // sign group
- int priority; // priority for highlighting
signlist_T *next; // next signlist entry
signlist_T *prev; // previous entry -- for easy reordering
};