To: vim_dev@googlegroups.com Subject: Patch 8.2.0073 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0073 Problem: Initializing globals with COMMA is clumsy. Solution: Use INIT2(), INIT3(), etc. Files: src/vim.h, src/globals.h *** ../vim-8.2.0072/src/vim.h 2019-12-31 21:27:09.555256491 +0100 --- src/vim.h 2020-01-01 15:42:53.214588255 +0100 *************** *** 1775,1785 **** #ifndef EXTERN # define EXTERN extern # define INIT(x) #else # ifndef INIT # define INIT(x) x # define DO_INIT - # define COMMA , # endif #endif --- 1775,1792 ---- #ifndef EXTERN # define EXTERN extern # define INIT(x) + # define INIT2(a, b) + # define INIT3(a, b, c) + # define INIT4(a, b, c, d) + # define INIT5(a, b, c, d, e) #else # ifndef INIT # define INIT(x) x + # define INIT2(a, b) = {a, b} + # define INIT3(a, b, c) = {a, b, c} + # define INIT4(a, b, c, d) = {a, b, c, d} + # define INIT5(a, b, c, d, e) = {a, b, c, d, e} # define DO_INIT # endif #endif *** ../vim-8.2.0072/src/globals.h 2019-12-29 23:04:20.286639911 +0100 --- src/globals.h 2020-01-01 15:42:31.442686447 +0100 *************** *** 270,276 **** * Stack of execution contexts. Each entry is an estack_T. * Current context is at ga_len - 1. */ ! EXTERN garray_T exestack INIT(= {0 COMMA 0 COMMA sizeof(estack_T) COMMA 50 COMMA NULL}); // name of error message source #define SOURCING_NAME (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_name) // line number in the message source or zero --- 270,276 ---- * Stack of execution contexts. Each entry is an estack_T. * Current context is at ga_len - 1. */ ! EXTERN garray_T exestack INIT5(0, 0, sizeof(estack_T), 50, NULL); // name of error message source #define SOURCING_NAME (((estack_T *)exestack.ga_data)[exestack.ga_len - 1].es_name) // line number in the message source or zero *************** *** 285,291 **** # ifdef FEAT_PROFILE EXTERN int do_profiling INIT(= PROF_NONE); // PROF_ values # endif ! EXTERN garray_T script_items INIT(= {0 COMMA 0 COMMA sizeof(scriptitem_T) COMMA 4 COMMA NULL}); #define SCRIPT_ITEM(id) (((scriptitem_T *)script_items.ga_data)[(id) - 1]) #define FUNCLINE(fp, j) ((char_u **)(fp->uf_lines.ga_data))[j] --- 285,291 ---- # ifdef FEAT_PROFILE EXTERN int do_profiling INIT(= PROF_NONE); // PROF_ values # endif ! EXTERN garray_T script_items INIT5(0, 0, sizeof(scriptitem_T), 4, NULL); #define SCRIPT_ITEM(id) (((scriptitem_T *)script_items.ga_data)[(id) - 1]) #define FUNCLINE(fp, j) ((char_u **)(fp->uf_lines.ga_data))[j] *************** *** 375,381 **** EXTERN int garbage_collect_at_exit INIT(= FALSE); // Script CTX being sourced or was sourced to define the current function. ! EXTERN sctx_T current_sctx INIT(= {0 COMMA 0 COMMA 0 COMMA 0}); #endif EXTERN int did_source_packages INIT(= FALSE); --- 375,381 ---- EXTERN int garbage_collect_at_exit INIT(= FALSE); // Script CTX being sourced or was sourced to define the current function. ! EXTERN sctx_T current_sctx INIT4(0, 0, 0, 0); #endif EXTERN int did_source_packages INIT(= FALSE); *************** *** 468,474 **** // When deleting the current buffer, another one must be loaded. If we know // which one is preferred, au_new_curbuf is set to it ! EXTERN bufref_T au_new_curbuf INIT(= {NULL COMMA 0 COMMA 0}); // When deleting a buffer/window and autocmd_busy is TRUE, do not free the // buffer/window. but link it in the list starting with --- 468,474 ---- // When deleting the current buffer, another one must be loaded. If we know // which one is preferred, au_new_curbuf is set to it ! EXTERN bufref_T au_new_curbuf INIT3(NULL, 0, 0); // When deleting a buffer/window and autocmd_busy is TRUE, do not free the // buffer/window. but link it in the list starting with *************** *** 1412,1418 **** EXTERN char psepc INIT(= '\\'); // normal path separator character EXTERN char psepcN INIT(= '/'); // abnormal path separator character // normal path separator string ! EXTERN char pseps[2] INIT(= {'\\' COMMA 0}); #endif // Set to TRUE when an operator is being executed with virtual editing, MAYBE --- 1412,1418 ---- EXTERN char psepc INIT(= '\\'); // normal path separator character EXTERN char psepcN INIT(= '/'); // abnormal path separator character // normal path separator string ! EXTERN char pseps[2] INIT2('\\', 0); #endif // Set to TRUE when an operator is being executed with virtual editing, MAYBE *** ../vim-8.2.0072/src/version.c 2020-01-01 15:26:27.927800691 +0100 --- src/version.c 2020-01-01 15:46:17.417683348 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 73, /**/ -- Two cows are standing together in a field. One asks the other: "So what do you think about this Mad Cow Disease?" The other replies: "That doesn't concern me. I'm a helicopter." /// 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 ///