summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc106
1 files changed, 7 insertions, 99 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index b4903990d..1f9684443 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -93,7 +93,7 @@ struct symlink_info
cwdstuff cygcwd; /* The current working directory. */
#define path_prefix_p(p1, p2, l1) \
- ((tolower(*(p1))==tolower(*(p2))) && \
+ ((cyg_tolower(*(p1))==cyg_tolower(*(p2))) && \
path_prefix_p_(p1, p2, l1))
#define SYMLINKATTR(x) \
@@ -450,7 +450,7 @@ get_raw_device_number (const char *uxname, const char *w32path, int &unit)
else if (isdrive (w32path + 4))
{
devn = FH_FLOPPY;
- unit = tolower (w32path[4]) - 'a';
+ unit = cyg_tolower (w32path[4]) - 'a';
}
else if (strncasematch (w32path, "\\\\.\\physicaldrive", 17))
{
@@ -1151,7 +1151,7 @@ mount_info::cygdrive_posix_path (const char *src, char *dst, int trailing_slash_
/* Now finish the path off with the drive letter to be used.
The cygdrive prefix always ends with a trailing slash so
the drive letter is added after the path. */
- dst[len++] = tolower (src[0]);
+ dst[len++] = cyg_tolower (src[0]);
if (!src[2] || (SLASH_P (src[2]) && !src[3]))
dst[len++] = '\000';
else
@@ -2395,7 +2395,7 @@ hash_path_name (unsigned long hash, const char *name)
char *nn, *newname = (char *) alloca (strlen (name) + 2);
nn = strncpy (newname, name, 2);
if (isupper (*nn))
- *newname = tolower (*nn);
+ *newname = cyg_tolower (*nn);
*(nn += 2) = '\0';
name += 2;
if (*name != '\\')
@@ -2427,7 +2427,7 @@ hashit:
\a\b\. but allow a single \ if that's all there is. */
do
{
- int ch = tolower(*name);
+ int ch = cyg_tolower(*name);
hash += ch + (ch << 17);
hash ^= hash >> 2;
}
@@ -2762,100 +2762,6 @@ cygwin_split_path (const char *path, char *dir, char *file)
file[end - last_slash - 1] = 0;
}
-/********************** 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 old_ch_case_eq(ch1, ch2) \
- ({ \
- unsigned char x; \
- !((x = ((unsigned char)ch1 ^ (unsigned char)ch2)) && \
- (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 */
-extern "C" int __stdcall
-strncasematch (const char *s1, const char *s2, size_t n)
-{
- if (s1 == s2)
- return 1;
-
- n++;
- while (--n && *s1)
- {
- if (!ch_case_eq (*s1, *s2))
- return 0;
- s1++; s2++;
- }
- return !n || *s2 == '\0';
-}
-
-/* Return TRUE if two strings match */
-extern "C" int __stdcall
-strcasematch (const char *s1, const char *s2)
-{
- if (s1 == s2)
- return 1;
-
- while (*s1)
- {
- if (!ch_case_eq (*s1, *s2))
- return 0;
- s1++; s2++;
- }
- return *s2 == '\0';
-}
-
-extern "C" char * __stdcall
-strcasestr (const char *searchee, const char *lookfor)
-{
- if (*searchee == 0)
- {
- if (*lookfor)
- return NULL;
- return (char *) searchee;
- }
-
- while (*searchee)
- {
- int i = 0;
- while (1)
- {
- if (lookfor[i] == 0)
- return (char *) searchee;
-
- if (!ch_case_eq (lookfor[i], searchee[i]))
- break;
- lookfor++;
- }
- searchee++;
- }
-
- return NULL;
-}
-
int __stdcall
check_null_empty_path (const char *name)
{
@@ -2869,6 +2775,8 @@ check_null_empty_path (const char *name)
return 0;
}
+/*****************************************************************************/
+
/* Return the hash value for the current win32 value.
This is used when constructing inodes. */
DWORD