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.
This commit is contained in:
Christopher Faylor 2001-09-06 04:41:59 +00:00
parent 4ce15a4980
commit 08b78edf5a
20 changed files with 45 additions and 38 deletions

View File

@ -1,3 +1,10 @@
Thu Sep 6 00:40:35 2001 Christopher Faylor <cgf@cygnus.com>
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 <cgf@cygnus.com> Wed Sep 5 23:36:03 2001 Christopher Faylor <cgf@cygnus.com>
* cygheap.h (init_cygheap): Move bucket array here from cygheap.cc. * cygheap.h (init_cygheap): Move bucket array here from cygheap.cc.

View File

@ -54,12 +54,12 @@ per_thread NO_COPY *threadstuff[] = {&waitq_storage,
&signal_dispatch_storage, &signal_dispatch_storage,
NULL}; NULL};
BOOL display_title = FALSE; BOOL display_title;
BOOL strip_title_path = FALSE; BOOL strip_title_path;
BOOL allow_glob = TRUE; BOOL allow_glob = TRUE;
codepage_type current_codepage = ansi_cp; 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. /* 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. This is subtracted from the signal number prior to shifting the bit.
@ -86,7 +86,7 @@ extern "C"
char **__cygwin_environ; char **__cygwin_environ;
char ***main_environ; char ***main_environ;
/* __progname used in getopt error message */ /* __progname used in getopt error message */
char *__progname = NULL; char *__progname;
struct _reent reent_data = _REENT_INIT(reent_data); struct _reent reent_data = _REENT_INIT(reent_data);
struct per_process __cygwin_user_data = struct per_process __cygwin_user_data =
{/* initial_sp */ 0, /* magic_biscuit */ 0, {/* initial_sp */ 0, /* magic_biscuit */ 0,
@ -110,14 +110,14 @@ extern "C"
/* resourcelocks */ &_reslock, /* threadinterface */ &_mtinterf, /* resourcelocks */ &_reslock, /* threadinterface */ &_mtinterf,
/* impure_ptr */ &reent_data, /* impure_ptr */ &reent_data,
}; };
bool ignore_case_with_glob = FALSE; bool ignore_case_with_glob;
int __declspec (dllexport) _check_for_executable = TRUE; int __declspec (dllexport) _check_for_executable = TRUE;
#ifdef DEBUGGING #ifdef DEBUGGING
int pinger = 0; int pinger;
#endif #endif
}; };
char *old_title = NULL; char *old_title;
char title_buf[TITLESIZE + 1]; char title_buf[TITLESIZE + 1];
static void static void
@ -621,8 +621,8 @@ alloc_stack (child_info_fork *ci)
} }
static NO_COPY int mypid = 0; static NO_COPY int mypid = 0;
int _declspec(dllexport) __argc = 0; int _declspec(dllexport) __argc;
char _declspec(dllexport) **__argv = NULL; char _declspec(dllexport) **__argv;
void void
sigthread::init (const char *s) sigthread::init (const char *s)

View File

@ -18,8 +18,8 @@ extern void __stdcall check_sanity_and_sync (per_process *);
dll_list NO_COPY dlls; dll_list NO_COPY dlls;
static NO_COPY int in_forkee = 0; static NO_COPY int in_forkee;
static int dll_global_dtors_recorded = 0; static int dll_global_dtors_recorded;
/* Run destructors for all DLLs on exit. */ /* Run destructors for all DLLs on exit. */
static void static void

View File

@ -40,7 +40,7 @@ extern int subauth_id;
BOOL reset_com = TRUE; BOOL reset_com = TRUE;
static BOOL envcache = TRUE; static BOOL envcache = TRUE;
static char **lastenviron = NULL; static char **lastenviron;
#define ENVMALLOC \ #define ENVMALLOC \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) \ (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; bool envp_passed_in;
static char cygterm[] = "TERM=cygwin"; static char cygterm[] = "TERM=cygwin";
static int initted = 0; static int initted;
if (!initted) if (!initted)
{ {
for (int i = 0; conv_envvars[i].name != NULL; i++) for (int i = 0; conv_envvars[i].name != NULL; i++)

View File

@ -35,7 +35,7 @@ fillout_pinfo (pid_t pid, int winpid)
if (!pids.npids || !nextpid) if (!pids.npids || !nextpid)
pids.init (winpid); pids.init (winpid);
static unsigned int i = 0; static unsigned int i;
if (!pid) if (!pid)
i = 0; i = 0;

View File

@ -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"; 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& inline fhandler_base&
fhandler_base::operator =(fhandler_base &x) fhandler_base::operator =(fhandler_base &x)

View File

@ -30,7 +30,7 @@ details. */
static const char *CYGWIN_NATIVE = "CYGWIN_NATIVE_CLIPBOARD"; static const char *CYGWIN_NATIVE = "CYGWIN_NATIVE_CLIPBOARD";
/* this is MT safe because windows format id's are atomic */ /* 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_dev_clipboard::fhandler_dev_clipboard (const char *name):
fhandler_base (FH_CLIPBOARD, name) fhandler_base (FH_CLIPBOARD, name)

View File

@ -35,7 +35,7 @@
#define ENTROPY_SOURCE_NAME "/dev/urandom" #define ENTROPY_SOURCE_NAME "/dev/urandom"
#define ENTROPY_SOURCE_DEV_UNIT 9 #define ENTROPY_SOURCE_DEV_UNIT 9
fhandler_dev_random* entropy_source = NULL; fhandler_dev_random* entropy_source;
/**********************************************************************/ /**********************************************************************/
/* fhandler_socket */ /* fhandler_socket */

View File

@ -109,7 +109,7 @@ public:
const char *tname; const char *tname;
} ostack[100]; } ostack[100];
static int osi = 0; static int osi;
#endif /*DEBUGGING*/ #endif /*DEBUGGING*/
DWORD DWORD

View File

@ -30,9 +30,9 @@ details. */
#include "dll_init.h" #include "dll_init.h"
#ifdef DEBUGGING #ifdef DEBUGGING
static int npid = 0; static int npid;
static int npid_max = 0; static int npid_max;
static pid_t fork_pids[100] = {0}; static pid_t fork_pids[100];
#endif #endif
DWORD NO_COPY chunksize = 0; DWORD NO_COPY chunksize = 0;

View File

@ -31,9 +31,9 @@ details. */
on the first call that needs information from it. */ on the first call that needs information from it. */
static NO_COPY const char *etc_group = "/etc/group"; static NO_COPY const char *etc_group = "/etc/group";
static struct group *group_buf = NULL; /* group contents in memory */ static struct group *group_buf; /* group contents in memory */
static int curr_lines = 0; static int curr_lines;
static int max_lines = 0; static int max_lines;
/* Position in the group cache */ /* Position in the group cache */
#ifdef _MT_SAFE #ifdef _MT_SAFE

View File

@ -19,7 +19,7 @@ details. */
#define assert(x) #define assert(x)
static unsigned page_const = 0; static unsigned page_const;
extern "C" size_t getpagesize (); extern "C" size_t getpagesize ();

View File

@ -640,12 +640,12 @@ static struct tm tm;
#undef _daylight #undef _daylight
#ifdef USG_COMPAT #ifdef USG_COMPAT
time_t timezone = 0; time_t timezone;
int daylight = 0; int daylight;
#endif /* defined USG_COMPAT */ #endif /* defined USG_COMPAT */
#ifdef ALTZONE #ifdef ALTZONE
time_t altzone = 0; time_t altzone;
#endif /* defined ALTZONE */ #endif /* defined ALTZONE */
static long static long

View File

@ -28,7 +28,7 @@ details. */
problems if malloced on our heap and free'd on theirs. 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; static int use_internal_malloc = 1;
#undef in #undef in

View File

@ -1072,8 +1072,8 @@ cygwin_gethostbyname (const char *name)
{ {
static unsigned char tmp_addr[4]; static unsigned char tmp_addr[4];
static struct hostent tmp; static struct hostent tmp;
static char *tmp_aliases[1] = {0}; static char *tmp_aliases[1];
static char *tmp_addr_list[2] = {0, 0}; static char *tmp_addr_list[2];
static int a, b, c, d; static int a, b, c, d;
if (sscanf (name, "%d.%d.%d.%d", &a, &b, &c, &d) == 4) if (sscanf (name, "%d.%d.%d.%d", &a, &b, &c, &d) == 4)

View File

@ -16,7 +16,7 @@ details. */
#include "security.h" #include "security.h"
/* Default to not using NTEA information */ /* Default to not using NTEA information */
BOOL allow_ntea = FALSE; BOOL allow_ntea;
/* /*
From Windows NT DDK: From Windows NT DDK:

View File

@ -31,7 +31,7 @@ static char NO_COPY pinfo_dummy[sizeof(pinfo)] = {0};
pinfo NO_COPY myself ((_pinfo *)&pinfo_dummy); // Avoid myself != NULL checks pinfo NO_COPY myself ((_pinfo *)&pinfo_dummy); // Avoid myself != NULL checks
HANDLE hexec_proc = NULL; HANDLE hexec_proc;
void __stdcall void __stdcall
pinfo_fixup_after_fork () pinfo_fixup_after_fork ()
@ -319,7 +319,7 @@ winpids::add (DWORD& nelem, bool winpid, DWORD pid)
DWORD DWORD
winpids::enumNT (bool winpid) winpids::enumNT (bool winpid)
{ {
static DWORD szprocs = 0; static DWORD szprocs;
static SYSTEM_PROCESSES *procs; static SYSTEM_PROCESSES *procs;
DWORD nelem = 0; DWORD nelem = 0;

View File

@ -31,7 +31,7 @@ details. */
shared_info NO_COPY *cygwin_shared = NULL; shared_info NO_COPY *cygwin_shared = NULL;
mount_info NO_COPY *mount_table = 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. */ /* General purpose security attribute objects for global use. */
SECURITY_ATTRIBUTES NO_COPY sec_none; SECURITY_ATTRIBUTES NO_COPY sec_none;

View File

@ -39,7 +39,7 @@ has_exec_chars (const char *buf, int len)
} }
char shortcut_header[SHORTCUT_HDR_SIZE]; char shortcut_header[SHORTCUT_HDR_SIZE];
BOOL shortcut_initalized = FALSE; BOOL shortcut_initalized;
void void
create_shortcut_header (void) create_shortcut_header (void)

View File

@ -295,7 +295,7 @@ tty::alive (const char *fmt)
char buf[sizeof (TTY_MASTER_ALIVE) + 16]; char buf[sizeof (TTY_MASTER_ALIVE) + 16];
__small_sprintf (buf, fmt, ntty); __small_sprintf (buf, fmt, ntty);
if ((ev = OpenEvent (EVENT_ALL_ACCESS, TRUE, buf))) if ((ev = OpenEvent (EVENT_ALL_ACCESS, FALSE, buf)))
CloseHandle (ev); CloseHandle (ev);
return ev != NULL; return ev != NULL;
} }