diff options
author | Joel Brobecker <brobecker@gnat.com> | 2011-07-01 18:24:39 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2011-07-01 18:24:39 +0000 |
commit | 7d6b320b79bc7bb87a7c8985c70036e56e4c2e9f (patch) | |
tree | 89ce45124730f73ec4546ae15012931b2431367a | |
parent | 02e7efbffbcf85bbb9766f4ca0d278a79b4ae2b3 (diff) | |
download | gdb-7d6b320b79bc7bb87a7c8985c70036e56e4c2e9f.zip gdb-7d6b320b79bc7bb87a7c8985c70036e56e4c2e9f.tar.gz gdb-7d6b320b79bc7bb87a7c8985c70036e56e4c2e9f.tar.bz2 |
[libiberty/filename_cmp] Darwin has case-insensitive filesystems
include/ChangeLog:
* filenames.h (HAVE_CASE_INSENSITIVE_FILE_SYSTEM): Define
on Darwin, as well as on the systems that use a DOS-like
filesystem.
libiberty/ChangeLog:
* filename_cmp.c (filename_cmp, filename_ncmp): Add handling of
HAVE_CASE_INSENSITIVE_FILE_SYSTEM.
-rw-r--r-- | include/ChangeLog | 6 | ||||
-rw-r--r-- | include/filenames.h | 8 | ||||
-rw-r--r-- | libiberty/ChangeLog | 5 | ||||
-rw-r--r-- | libiberty/filename_cmp.c | 28 |
4 files changed, 41 insertions, 6 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index c99733e..c80aeb8 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2011-07-01 Joel Brobecker <brobecker@adacore.com> + + * filenames.h (HAVE_CASE_INSENSITIVE_FILE_SYSTEM): Define + on Darwin, as well as on the systems that use a DOS-like + filesystem. + 2011-06-22 Jakub Jelinek <jakub@redhat.com> PR debug/47858 diff --git a/include/filenames.h b/include/filenames.h index d4955df..75ec330 100644 --- a/include/filenames.h +++ b/include/filenames.h @@ -34,10 +34,18 @@ extern "C" { # ifndef HAVE_DOS_BASED_FILE_SYSTEM # define HAVE_DOS_BASED_FILE_SYSTEM 1 # endif +# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM +# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 +# endif # define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f) # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c) # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f) #else /* not DOSish */ +# if defined(__APPLE__) +# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM +# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 +# endif +# endif /* __APPLE__ */ # define HAS_DRIVE_SPEC(f) (0) # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c) # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 809f22b..2f8e734 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,8 @@ +2011-07-01 Joel Brobecker <brobecker@adacore.com> + + * filename_cmp.c (filename_cmp, filename_ncmp): Add handling of + HAVE_CASE_INSENSITIVE_FILE_SYSTEM. + 2011-07-01 Jan Kratochvil <jan.kratochvil@redhat.com> PR debug/49408 diff --git a/libiberty/filename_cmp.c b/libiberty/filename_cmp.c index 0eed120..5179f8d 100644 --- a/libiberty/filename_cmp.c +++ b/libiberty/filename_cmp.c @@ -50,19 +50,27 @@ and backward slashes are equal. int filename_cmp (const char *s1, const char *s2) { -#ifndef HAVE_DOS_BASED_FILE_SYSTEM +#if !defined(HAVE_DOS_BASED_FILE_SYSTEM) \ + && !defined(HAVE_CASE_INSENSITIVE_FILE_SYSTEM) return strcmp(s1, s2); #else for (;;) { - int c1 = TOLOWER (*s1); - int c2 = TOLOWER (*s2); + int c1 = *s1; + int c2 = *s2; +#if defined (HAVE_CASE_INSENSITIVE_FILE_SYSTEM) + c1 = TOLOWER (c1); + c2 = TOLOWER (c2); +#endif + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* On DOS-based file systems, the '/' and the '\' are equivalent. */ if (c1 == '/') c1 = '\\'; if (c2 == '/') c2 = '\\'; +#endif if (c1 != c2) return (c1 - c2); @@ -100,21 +108,29 @@ and backward slashes are equal. int filename_ncmp (const char *s1, const char *s2, size_t n) { -#ifndef HAVE_DOS_BASED_FILE_SYSTEM +#if !defined(HAVE_DOS_BASED_FILE_SYSTEM) \ + && !defined(HAVE_CASE_INSENSITIVE_FILE_SYSTEM) return strncmp(s1, s2, n); #else if (!n) return 0; for (; n > 0; --n) { - int c1 = TOLOWER (*s1); - int c2 = TOLOWER (*s2); + int c1 = *s1; + int c2 = *s2; +#if defined (HAVE_CASE_INSENSITIVE_FILE_SYSTEM) + c1 = TOLOWER (c1); + c2 = TOLOWER (c2); +#endif + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* On DOS-based file systems, the '/' and the '\' are equivalent. */ if (c1 == '/') c1 = '\\'; if (c2 == '/') c2 = '\\'; +#endif if (c1 == '\0' || c1 != c2) return (c1 - c2); |