Convert some extern variables to static, Windows code
authorPeter Eisentraut <[email protected]>
Thu, 1 Aug 2024 10:41:26 +0000 (12:41 +0200)
committerPeter Eisentraut <[email protected]>
Thu, 1 Aug 2024 11:28:32 +0000 (13:28 +0200)
Similar to 720b0eaae9b, discovered by MinGW.

src/bin/pg_upgrade/parallel.c
src/bin/pgevent/pgevent.c
src/common/restricted_token.c
src/interfaces/libpq/win32.c

index 05313a9b156418f16d722df7b885056dda896ea3..a003e12896629256ab1111bcdab61afe0c7f1724 100644 (file)
@@ -24,7 +24,7 @@ static int    parallel_jobs;
  * it can be passed to WaitForMultipleObjects().  We use two arrays
  * so the thread_handles array can be passed to WaitForMultipleObjects().
  */
-HANDLE    *thread_handles;
+static HANDLE *thread_handles;
 
 typedef struct
 {
@@ -42,11 +42,11 @@ typedef struct
    char       *old_tablespace;
 } transfer_thread_arg;
 
-exec_thread_arg **exec_thread_args;
-transfer_thread_arg **transfer_thread_args;
+static exec_thread_arg **exec_thread_args;
+static transfer_thread_arg **transfer_thread_args;
 
 /* track current thread_args struct so reap_child() can be used for all cases */
-void     **cur_thread_args;
+static void **cur_thread_args;
 
 DWORD      win32_exec_prog(exec_thread_arg *args);
 DWORD      win32_transfer_all_new_dbs(transfer_thread_arg *args);
index 807a2c93120d61f9c479ad4fda9f9a557b3c31e3..020893342aaa76930bd0bb911f66f1975a5862bd 100644 (file)
 #include <olectl.h>
 
 /* Global variables */
-HANDLE     g_module = NULL;    /* hModule of DLL */
+static HANDLE g_module = NULL; /* hModule of DLL */
 
 /*
  * The event source is stored as a registry key.
  * The maximum length of a registry key is 255 characters.
  * http://msdn.microsoft.com/en-us/library/ms724872(v=vs.85).aspx
  */
-char       event_source[256] = DEFAULT_EVENT_SOURCE;
+static char event_source[256] = DEFAULT_EVENT_SOURCE;
 
 /* Prototypes */
 HRESULT        DllInstall(BOOL bInstall, LPCWSTR pszCmdLine);
index d04101d6d15d22e52714a8c3983359edc7563ce0..6940e927e7d6f41a5e8cdd5ca764eff80612208d 100644 (file)
@@ -26,7 +26,7 @@
 #ifdef WIN32
 
 /* internal vars */
-char      *restrict_env;
+static char *restrict_env;
 
 /* Windows API define missing from some versions of MingW headers */
 #ifndef  DISABLE_MAX_PRIVILEGE
index c738dee69119cc16ee6aec683f4813e07bbdc826..d3ac0bb1966a247fa2cbd9c48b509d8724bbeb0a 100644 (file)
@@ -231,7 +231,7 @@ LookupWSErrorMessage(DWORD err, char *dest)
 }
 
 
-struct MessageDLL
+static struct MessageDLL
 {
    const char *dll_name;
    void       *handle;