* dcrt0.cc (dll_crt0_1): init cygcwd before forkee branch
* environ.cc (conv_start_chars): Cache a table of "first characters" for environment variables needing conversion. (getwinenv): Use it. (environ_init): Create it, also check first chars for TERM and CYGWIN. * path.cc: Use lookup table for case insensitive comparisons.
This commit is contained in:
parent
b8cb783f28
commit
6e8f36bc43
@ -1,3 +1,15 @@
|
|||||||
|
2000-10-18 DJ Delorie <dj@redhat.com>
|
||||||
|
|
||||||
|
* dcrt0.cc (dll_crt0_1): init cygcwd before forkee branch
|
||||||
|
|
||||||
|
* environ.cc (conv_start_chars): Cache a table of "first
|
||||||
|
characters" for environment variables needing conversion.
|
||||||
|
(getwinenv): Use it.
|
||||||
|
(environ_init): Create it, also check first chars for TERM and
|
||||||
|
CYGWIN.
|
||||||
|
|
||||||
|
* path.cc: Use lookup table for case insensitive comparisons.
|
||||||
|
|
||||||
Wed Oct 18 00:48:49 2000 Christopher Faylor <cgf@cygnus.com>
|
Wed Oct 18 00:48:49 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* exceptions.cc (call_handler): Make signal pending if sigsave.sig is
|
* exceptions.cc (call_handler): Make signal pending if sigsave.sig is
|
||||||
|
@ -739,6 +739,8 @@ dll_crt0_1 ()
|
|||||||
instead of each time a file is opened. */
|
instead of each time a file is opened. */
|
||||||
set_process_privileges ();
|
set_process_privileges ();
|
||||||
|
|
||||||
|
cygcwd.init ();
|
||||||
|
|
||||||
cygbench ("pre-forkee");
|
cygbench ("pre-forkee");
|
||||||
|
|
||||||
if (user_data->forkee)
|
if (user_data->forkee)
|
||||||
@ -759,8 +761,6 @@ dll_crt0_1 ()
|
|||||||
longjmp (fork_info->jmp, fork_info->cygpid);
|
longjmp (fork_info->jmp, fork_info->cygpid);
|
||||||
}
|
}
|
||||||
|
|
||||||
cygcwd.init ();
|
|
||||||
|
|
||||||
/* Initialize our process table entry. */
|
/* Initialize our process table entry. */
|
||||||
pinfo_init (envp, envc);
|
pinfo_init (envp, envc);
|
||||||
|
|
||||||
|
@ -61,6 +61,8 @@ static win_env conv_envvars[] =
|
|||||||
{NULL, 0, NULL, NULL, NULL, NULL, 0, 0}
|
{NULL, 0, NULL, NULL, NULL, NULL, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static unsigned char conv_start_chars[256] = {0};
|
||||||
|
|
||||||
void
|
void
|
||||||
win_env::add_cache (const char *in_posix, const char *in_native)
|
win_env::add_cache (const char *in_posix, const char *in_native)
|
||||||
{
|
{
|
||||||
@ -91,6 +93,9 @@ win_env::add_cache (const char *in_posix, const char *in_native)
|
|||||||
win_env * __stdcall
|
win_env * __stdcall
|
||||||
getwinenv (const char *env, const char *in_posix)
|
getwinenv (const char *env, const char *in_posix)
|
||||||
{
|
{
|
||||||
|
if (!conv_start_chars[(unsigned char)*env])
|
||||||
|
return NULL;
|
||||||
|
|
||||||
for (int i = 0; conv_envvars[i].name != NULL; i++)
|
for (int i = 0; conv_envvars[i].name != NULL; i++)
|
||||||
if (strncasematch (env, conv_envvars[i].name, conv_envvars[i].namelen))
|
if (strncasematch (env, conv_envvars[i].name, conv_envvars[i].namelen))
|
||||||
{
|
{
|
||||||
@ -528,6 +533,17 @@ 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;
|
||||||
|
if (!initted)
|
||||||
|
{
|
||||||
|
for (int i = 0; conv_envvars[i].name != NULL; i++)
|
||||||
|
{
|
||||||
|
conv_start_chars[tolower(conv_envvars[i].name[0])] = 1;
|
||||||
|
conv_start_chars[toupper(conv_envvars[i].name[0])] = 1;
|
||||||
|
}
|
||||||
|
initted = 1;
|
||||||
|
}
|
||||||
|
|
||||||
regopt ("default");
|
regopt ("default");
|
||||||
if (myself->progname[0])
|
if (myself->progname[0])
|
||||||
regopt (myself->progname);
|
regopt (myself->progname);
|
||||||
@ -571,11 +587,11 @@ environ_init (char **envp, int envc)
|
|||||||
eq = strchr (newp, '\0');
|
eq = strchr (newp, '\0');
|
||||||
if (!parent_alive)
|
if (!parent_alive)
|
||||||
ucenv (newp, eq);
|
ucenv (newp, eq);
|
||||||
if (strncmp (newp, "TERM=", 5) == 0)
|
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
|
||||||
sawTERM = 1;
|
sawTERM = 1;
|
||||||
if (strncmp (newp, "CYGWIN=", sizeof("CYGWIN=") - 1) == 0)
|
if (*newp == 'C' && strncmp (newp, "CYGWIN=", sizeof("CYGWIN=") - 1) == 0)
|
||||||
parse_options (newp + sizeof("CYGWIN=") - 1);
|
parse_options (newp + sizeof("CYGWIN=") - 1);
|
||||||
if (*eq)
|
if (*eq && conv_start_chars[(unsigned char)envp[i][0]])
|
||||||
posify (envp + i, *++eq ? eq : --eq);
|
posify (envp + i, *++eq ? eq : --eq);
|
||||||
debug_printf ("%s", envp[i]);
|
debug_printf ("%s", envp[i]);
|
||||||
}
|
}
|
||||||
|
@ -2764,14 +2764,37 @@ cygwin_split_path (const char *path, char *dir, char *file)
|
|||||||
|
|
||||||
/********************** String Helper Functions ************************/
|
/********************** String Helper Functions ************************/
|
||||||
|
|
||||||
|
static char case_folded[] = {
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
|
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||||
|
32, '!', '"', '#', '$', '%', '&', 39, '(', ')', '*', '+', ',', '-', '.', '/',
|
||||||
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
|
||||||
|
'@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||||
|
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '[', 92, ']', '^', '_',
|
||||||
|
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
|
||||||
|
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 127,
|
||||||
|
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
|
||||||
|
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||||
|
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||||
|
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
|
||||||
|
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
|
||||||
|
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
|
||||||
|
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||||
|
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||||
|
};
|
||||||
|
|
||||||
#define CHXOR ('a' ^ 'A')
|
#define CHXOR ('a' ^ 'A')
|
||||||
#define ch_case_eq(ch1, ch2) \
|
#define old_ch_case_eq(ch1, ch2) \
|
||||||
({ \
|
({ \
|
||||||
unsigned char x; \
|
unsigned char x; \
|
||||||
!((x = ((unsigned char)ch1 ^ (unsigned char)ch2)) && \
|
!((x = ((unsigned char)ch1 ^ (unsigned char)ch2)) && \
|
||||||
(x != CHXOR || !isalpha (ch1))); \
|
(x != CHXOR || !isalpha (ch1))); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// This is about 10% faster than the above logic, on average
|
||||||
|
#define ch_case_eq(ch1, ch2) (case_folded[(unsigned char)(ch1)] \
|
||||||
|
== case_folded[(unsigned char)(ch2)])
|
||||||
|
|
||||||
/* Return TRUE if two strings match up to length n */
|
/* Return TRUE if two strings match up to length n */
|
||||||
extern "C" int __stdcall
|
extern "C" int __stdcall
|
||||||
strncasematch (const char *s1, const char *s2, size_t n)
|
strncasematch (const char *s1, const char *s2, size_t n)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user