To: vim_dev@googlegroups.com Subject: Patch 8.2.2821 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2821 Author: Problem: MS-Windows: unnessarily loading libraries when registering OLE. Solution: Skip loading libraries when invoked with "-register". Files: src/main.c, src/globals.h, src/os_win32.c *** ../vim-8.2.2820/src/main.c 2021-03-27 12:11:29.914607383 +0100 --- src/main.c 2021-05-01 17:45:22.564818899 +0200 *************** *** 161,166 **** --- 161,180 ---- break; } #endif + #ifdef MSWIN + // Need to find "-register" before loading any libraries. + for (i = 1; i < argc; ++i) + if (STRICMP(argv[i] + 1, "register") == 0 + && (argv[i][0] == '-' || argv[i][0] == '/')) + { + found_register_arg = TRUE; + break; + } + #endif + + /* + * Various initialisations shared with tests. + */ common_init(¶ms); #ifdef VIMDLL *** ../vim-8.2.2820/src/globals.h 2021-04-23 21:01:30.649469081 +0200 --- src/globals.h 2021-05-01 17:38:34.462305532 +0200 *************** *** 1311,1316 **** --- 1311,1317 ---- #ifdef MSWIN EXTERN char_u toupper_tab[256]; // table for toupper() EXTERN char_u tolower_tab[256]; // table for tolower() + EXTERN int found_register_arg INIT(= FALSE); #endif #ifdef FEAT_LINEBREAK *** ../vim-8.2.2820/src/os_win32.c 2021-04-21 11:30:19.666720540 +0200 --- src/os_win32.c 2021-05-01 17:36:23.938781433 +0200 *************** *** 529,534 **** --- 529,538 ---- { HINSTANCE dll = NULL; + // No need to load any library when registering OLE. + if (found_register_arg) + return dll; + // NOTE: Do not use mch_dirname() and mch_chdir() here, they may call // vimLoadLib() recursively, which causes a stack overflow. if (exe_path == NULL) *** ../vim-8.2.2820/src/version.c 2021-04-30 21:37:45.679056272 +0200 --- src/version.c 2021-05-01 17:37:43.142492544 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2821, /**/ -- "You mean there really is an answer?" "Yes! But you're not going to like it!" "Oh do please tell us!" "You're really not going to like it!" "but we MUST know - tell us" "Alright, the answer is...." "yes..." "... is ..." "yes... come on!" "is 42!" (Douglas Adams - The Hitchhiker's Guide to the Galaxy) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///