diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d256cc263..69bdb99a8 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +Thu Sep 6 00:40:35 2001 Christopher Faylor + + Remove initialization of static or global values to zero, throughout. + This just needlessly grows the size of the DLL. + * tty.cc (tty::alive): Make inuse handle non-inheriting on open, just + for thread safety. + Wed Sep 5 23:36:03 2001 Christopher Faylor * cygheap.h (init_cygheap): Move bucket array here from cygheap.cc. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index f4acc8d44..43940b435 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -54,12 +54,12 @@ per_thread NO_COPY *threadstuff[] = {&waitq_storage, &signal_dispatch_storage, NULL}; -BOOL display_title = FALSE; -BOOL strip_title_path = FALSE; +BOOL display_title; +BOOL strip_title_path; BOOL allow_glob = TRUE; codepage_type current_codepage = ansi_cp; -int cygwin_finished_initializing = 0; +int cygwin_finished_initializing; /* Used in SIGTOMASK for generating a bit for insertion into a sigset_t. This is subtracted from the signal number prior to shifting the bit. @@ -86,7 +86,7 @@ extern "C" char **__cygwin_environ; char ***main_environ; /* __progname used in getopt error message */ - char *__progname = NULL; + char *__progname; struct _reent reent_data = _REENT_INIT(reent_data); struct per_process __cygwin_user_data = {/* initial_sp */ 0, /* magic_biscuit */ 0, @@ -110,14 +110,14 @@ extern "C" /* resourcelocks */ &_reslock, /* threadinterface */ &_mtinterf, /* impure_ptr */ &reent_data, }; - bool ignore_case_with_glob = FALSE; + bool ignore_case_with_glob; int __declspec (dllexport) _check_for_executable = TRUE; #ifdef DEBUGGING - int pinger = 0; + int pinger; #endif }; -char *old_title = NULL; +char *old_title; char title_buf[TITLESIZE + 1]; static void @@ -621,8 +621,8 @@ alloc_stack (child_info_fork *ci) } static NO_COPY int mypid = 0; -int _declspec(dllexport) __argc = 0; -char _declspec(dllexport) **__argv = NULL; +int _declspec(dllexport) __argc; +char _declspec(dllexport) **__argv; void sigthread::init (const char *s) diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc index 6a299d45b..74bec0769 100644 --- a/winsup/cygwin/dll_init.cc +++ b/winsup/cygwin/dll_init.cc @@ -18,8 +18,8 @@ extern void __stdcall check_sanity_and_sync (per_process *); dll_list NO_COPY dlls; -static NO_COPY int in_forkee = 0; -static int dll_global_dtors_recorded = 0; +static NO_COPY int in_forkee; +static int dll_global_dtors_recorded; /* Run destructors for all DLLs on exit. */ static void diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 0e4e3310a..ab5766375 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -40,7 +40,7 @@ extern int subauth_id; BOOL reset_com = TRUE; static BOOL envcache = TRUE; -static char **lastenviron = NULL; +static char **lastenviron; #define ENVMALLOC \ (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) \ @@ -641,7 +641,7 @@ environ_init (char **envp, int envc) bool envp_passed_in; static char cygterm[] = "TERM=cygwin"; - static int initted = 0; + static int initted; if (!initted) { for (int i = 0; conv_envvars[i].name != NULL; i++) diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index 4eed55fb6..9bbdc6024 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -35,7 +35,7 @@ fillout_pinfo (pid_t pid, int winpid) if (!pids.npids || !nextpid) pids.init (winpid); - static unsigned int i = 0; + static unsigned int i; if (!pid) i = 0; diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 115a4c796..6dd65bd59 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -30,9 +30,9 @@ static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */ static char fhandler_disk_dummy_name[] = "some disk file"; -struct __cygwin_perfile *perfile_table = NULL; +struct __cygwin_perfile *perfile_table; -DWORD binmode = 0; +DWORD binmode; inline fhandler_base& fhandler_base::operator =(fhandler_base &x) diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_clipboard.cc index ad7ec8733..97aaad884 100644 --- a/winsup/cygwin/fhandler_clipboard.cc +++ b/winsup/cygwin/fhandler_clipboard.cc @@ -30,7 +30,7 @@ details. */ static const char *CYGWIN_NATIVE = "CYGWIN_NATIVE_CLIPBOARD"; /* this is MT safe because windows format id's are atomic */ -static UINT cygnativeformat = 0; +static UINT cygnativeformat; fhandler_dev_clipboard::fhandler_dev_clipboard (const char *name): fhandler_base (FH_CLIPBOARD, name) diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 830ced5ae..aabaa47b7 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -35,7 +35,7 @@ #define ENTROPY_SOURCE_NAME "/dev/urandom" #define ENTROPY_SOURCE_DEV_UNIT 9 -fhandler_dev_random* entropy_source = NULL; +fhandler_dev_random* entropy_source; /**********************************************************************/ /* fhandler_socket */ diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index d5c5f739b..e3ca86d55 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -109,7 +109,7 @@ public: const char *tname; } ostack[100]; -static int osi = 0; +static int osi; #endif /*DEBUGGING*/ DWORD diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 173c02b1b..696daaf05 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -30,9 +30,9 @@ details. */ #include "dll_init.h" #ifdef DEBUGGING -static int npid = 0; -static int npid_max = 0; -static pid_t fork_pids[100] = {0}; +static int npid; +static int npid_max; +static pid_t fork_pids[100]; #endif DWORD NO_COPY chunksize = 0; diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 600302c95..e73c9a058 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -31,9 +31,9 @@ details. */ on the first call that needs information from it. */ static NO_COPY const char *etc_group = "/etc/group"; -static struct group *group_buf = NULL; /* group contents in memory */ -static int curr_lines = 0; -static int max_lines = 0; +static struct group *group_buf; /* group contents in memory */ +static int curr_lines; +static int max_lines; /* Position in the group cache */ #ifdef _MT_SAFE diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc index 6d217cab3..3fd6d5465 100644 --- a/winsup/cygwin/heap.cc +++ b/winsup/cygwin/heap.cc @@ -19,7 +19,7 @@ details. */ #define assert(x) -static unsigned page_const = 0; +static unsigned page_const; extern "C" size_t getpagesize (); diff --git a/winsup/cygwin/localtime.cc b/winsup/cygwin/localtime.cc index 573ec8c8c..daf888a04 100644 --- a/winsup/cygwin/localtime.cc +++ b/winsup/cygwin/localtime.cc @@ -640,12 +640,12 @@ static struct tm tm; #undef _daylight #ifdef USG_COMPAT -time_t timezone = 0; -int daylight = 0; +time_t timezone; +int daylight; #endif /* defined USG_COMPAT */ #ifdef ALTZONE -time_t altzone = 0; +time_t altzone; #endif /* defined ALTZONE */ static long diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc index 43bb0c52a..783fec956 100644 --- a/winsup/cygwin/malloc_wrapper.cc +++ b/winsup/cygwin/malloc_wrapper.cc @@ -28,7 +28,7 @@ details. */ problems if malloced on our heap and free'd on theirs. */ -static int export_malloc_called = 0; +static int export_malloc_called; static int use_internal_malloc = 1; #undef in diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 1715b16cb..34489da8e 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -1072,8 +1072,8 @@ cygwin_gethostbyname (const char *name) { static unsigned char tmp_addr[4]; static struct hostent tmp; - static char *tmp_aliases[1] = {0}; - static char *tmp_addr_list[2] = {0, 0}; + static char *tmp_aliases[1]; + static char *tmp_addr_list[2]; static int a, b, c, d; if (sscanf (name, "%d.%d.%d.%d", &a, &b, &c, &d) == 4) diff --git a/winsup/cygwin/ntea.cc b/winsup/cygwin/ntea.cc index 1d5c77cd4..421610060 100644 --- a/winsup/cygwin/ntea.cc +++ b/winsup/cygwin/ntea.cc @@ -16,7 +16,7 @@ details. */ #include "security.h" /* Default to not using NTEA information */ -BOOL allow_ntea = FALSE; +BOOL allow_ntea; /* From Windows NT DDK: diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 63ecce4e5..14e8b819b 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -31,7 +31,7 @@ static char NO_COPY pinfo_dummy[sizeof(pinfo)] = {0}; pinfo NO_COPY myself ((_pinfo *)&pinfo_dummy); // Avoid myself != NULL checks -HANDLE hexec_proc = NULL; +HANDLE hexec_proc; void __stdcall pinfo_fixup_after_fork () @@ -319,7 +319,7 @@ winpids::add (DWORD& nelem, bool winpid, DWORD pid) DWORD winpids::enumNT (bool winpid) { - static DWORD szprocs = 0; + static DWORD szprocs; static SYSTEM_PROCESSES *procs; DWORD nelem = 0; diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 91fc48e5f..5622765fa 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -31,7 +31,7 @@ details. */ shared_info NO_COPY *cygwin_shared = NULL; mount_info NO_COPY *mount_table = NULL; -HANDLE cygwin_mount_h = NULL; +HANDLE cygwin_mount_h; /* General purpose security attribute objects for global use. */ SECURITY_ATTRIBUTES NO_COPY sec_none; diff --git a/winsup/cygwin/shortcut.c b/winsup/cygwin/shortcut.c index 1aaa5de9e..fd684e83b 100644 --- a/winsup/cygwin/shortcut.c +++ b/winsup/cygwin/shortcut.c @@ -39,7 +39,7 @@ has_exec_chars (const char *buf, int len) } char shortcut_header[SHORTCUT_HDR_SIZE]; -BOOL shortcut_initalized = FALSE; +BOOL shortcut_initalized; void create_shortcut_header (void) diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc index 613aa2969..7edfdd217 100644 --- a/winsup/cygwin/tty.cc +++ b/winsup/cygwin/tty.cc @@ -295,7 +295,7 @@ tty::alive (const char *fmt) char buf[sizeof (TTY_MASTER_ALIVE) + 16]; __small_sprintf (buf, fmt, ntty); - if ((ev = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf))) + if ((ev = OpenEvent (EVENT_ALL_ACCESS, FALSE, buf))) CloseHandle (ev); return ev != NULL; }