To: vim_dev@googlegroups.com Subject: Patch 8.1.2285 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2285 Problem: Padding in structures wastes memory. Solution: Move fields to avoid padding. (Dominique Pelle, closes #5202) Files: src/structs.h *** ../vim-8.1.2284/src/structs.h 2019-11-09 23:26:36.901570979 +0100 --- src/structs.h 2019-11-10 15:05:51.851388073 +0100 *************** *** 558,565 **** */ typedef struct expand { - int xp_context; // type of expansion char_u *xp_pattern; // start of item to expand int xp_pattern_len; // bytes in xp_pattern before cursor #if defined(FEAT_EVAL) char_u *xp_arg; // completion function --- 558,565 ---- */ typedef struct expand { char_u *xp_pattern; // start of item to expand + int xp_context; // type of expansion int xp_pattern_len; // bytes in xp_pattern before cursor #if defined(FEAT_EVAL) char_u *xp_arg; // completion function *************** *** 572,580 **** #endif int xp_numfiles; // number of files found by // file name completion char_u **xp_files; // list of files char_u *xp_line; // text being completed - int xp_col; // cursor position in line } expand_T; /* --- 572,580 ---- #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 } expand_T; /* *************** *** 712,730 **** memfile_T *ml_mfp; // pointer to associated memfile #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 - colnr_T ml_line_len; // length of the cached line, including NUL bhdr_T *ml_locked; // block used by last ml_get linenr_T ml_locked_low; // first line in ml_locked --- 712,730 ---- 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; ! colnr_T ml_line_len; // length of the cached line, including NUL linenr_T ml_line_lnum; // line number of cached line, 0 if not valid char_u *ml_line_ptr; // pointer to cached line bhdr_T *ml_locked; // block used by last ml_get linenr_T ml_locked_low; // first line in ml_locked *************** *** 784,793 **** struct sign_entry { int se_id; // unique identifier for each placed sign - linenr_T se_lnum; // line number which has this sign int se_typenr; // typenr of sign - signgroup_T *se_group; // sign group int se_priority; // priority for highlighting sign_entry_T *se_next; // next entry in a list of signs sign_entry_T *se_prev; // previous entry -- for easy reordering }; --- 784,793 ---- struct sign_entry { int se_id; // unique identifier for each placed sign int se_typenr; // typenr of sign int se_priority; // priority for highlighting + linenr_T se_lnum; // line number which has this sign + signgroup_T *se_group; // sign group sign_entry_T *se_next; // next entry in a list of signs sign_entry_T *se_prev; // previous entry -- for easy reordering }; *************** *** 827,833 **** /* * 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. */ typedef struct argentry { --- 827,833 ---- /* * 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). */ typedef struct argentry { *************** *** 2905,2914 **** 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 #ifdef FEAT_CONCEAL int conceal_char; // cchar for Conceal highlighting #endif --- 2905,2914 ---- int id; // match ID int priority; // match priority char_u *pattern; // pattern to highlight 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 #ifdef FEAT_CONCEAL int conceal_char; // cchar for Conceal highlighting #endif *************** *** 3750,3758 **** 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 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 alloc. mem or NULL. --- 3750,3758 ---- 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 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 alloc. mem or NULL. *** ../vim-8.1.2284/src/version.c 2019-11-10 01:32:06.013009118 +0100 --- src/version.c 2019-11-10 15:06:04.279324619 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2285, /**/ -- "I don’t know how to make a screenshot" - Richard Stallman, July 2002 (when asked to send a screenshot of his desktop for unix.se) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///