]> granicus.if.org Git - vim/commitdiff
patch 8.2.2821: MS-Windows: unnessarily loading libraries when registering OLE v8.2.2821
authorBram Moolenaar <Bram@vim.org>
Sat, 1 May 2021 15:46:03 +0000 (17:46 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 1 May 2021 15:46:03 +0000 (17:46 +0200)
Problem:    MS-Windows: unnessarily loading libraries when registering OLE.
Solution:   Skip loading libraries when invoked with "-register".

src/globals.h
src/main.c
src/os_win32.c
src/version.c

index 5e6b6461d9bac294d17393bcc398ac295badfb44..b6541a4f4ffc0392b0367cd20ccb16f2b6672db2 100644 (file)
@@ -1311,6 +1311,7 @@ EXTERN int  wild_menu_showing INIT(= 0);
 #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
index 30014d4be2753b97c95de41068ecb7af372f5aab..686fb143247ec546751a8a8d2a11af1be248a57f 100644 (file)
@@ -161,6 +161,20 @@ main
            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(&params);
 
 #ifdef VIMDLL
index d40d0332c2408515a37feae4980a6b701e5adcda..3bfeee66ec8ba6323dd2c246a407b63aa0fe9abd 100644 (file)
@@ -529,6 +529,10 @@ vimLoadLib(char *name)
 {
     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)
index ed632f7ba949126a71d52e0c693099d4b7014584..8140e20fa78511b701752149f81f021e3d5959f8 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2821,
 /**/
     2820,
 /**/