]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2011-03-23 Kai Tietz <ktietz@redhat.com>
authorKai Tietz <kai.tietz@onevision.com>
Wed, 23 Mar 2011 18:23:56 +0000 (18:23 +0000)
committerKai Tietz <kai.tietz@onevision.com>
Wed, 23 Mar 2011 18:23:56 +0000 (18:23 +0000)
* breakpoint.c (clear_command): Use filename_cmp
instead of strcmp for comparison.
* buildsym.c (watch_main_source_file_lossage): Likewise.
(patch_subfile_names): Use IS_DIR_SEPARATOR instead of
checking just for slash.
* dbxread.c (read_dbx_symtab): Use lbasename instead of
strrchr and filename_cmp instead of strcmp for filenames.
(add_old_header_file): Use filename_cmp
instead of strcmp for comparison.
* exec.c (exec_set_section_address): Likewise.
* macrotab.c (macro_lookup_inclusion): Likewise.
(macro_lookup_inclusion): Likewise.
* elfread.c (_initialize_elfread): Likewise.
(elfstab_offset_sections): Likewise.
(elfstab_offset_sections): Use lbasename instead of
strrchr.
* mdebugread.c (parse_partial_symbols): Likewise.
(arse_partial_symbols): Use filename_(n)cmp instead of
str(n)cmp for comparison.
* minsyms.c (lookup_minimal_symbol): Likewise.
* psymtab.c (read_psymtabs_with_filename): Likewise.
* solib.c (solib_read_symbols): Likewise.
(reload_shared_libraries_1): Likewise.
* symmisc.c (maintenance_print_symbols): Likewise.
* symfile.c (separate_debug_file_exists): Likewise.
(reread_symbols): Likewise.
(find_separate_debug_file_by_debuglink): Likewise.
* remote-fileio.c (remote_fileio_func_rename): Likewise.
* source.c (add_path): Likewise.
* symtab.c (filename_seen): Likewise.
(file_matches): Likewise.
(print_symbol_info): Likewise.
(maybe_add_partial_symtab_filename): Likewise.
(make_source_files_completion_list): Likewise.
* xml-syscall.c (init_sysinfo): Likewise.
* windows-nat.c (_initialize_check_for_gdb_ini): Use
IS_DIR_SEPARATOR for checking for trailing path separator.

18 files changed:
gdb/ChangeLog
gdb/breakpoint.c
gdb/buildsym.c
gdb/dbxread.c
gdb/elfread.c
gdb/exec.c
gdb/macrotab.c
gdb/mdebugread.c
gdb/minsyms.c
gdb/psymtab.c
gdb/remote-fileio.c
gdb/solib.c
gdb/source.c
gdb/symfile.c
gdb/symmisc.c
gdb/symtab.c
gdb/windows-nat.c
gdb/xml-syscall.c

index c7f8dfe1de8c0fe98e04c0f2fd915fdb87592283..8f259c1aa38aa969e4073a06b717280d03cdace7 100644 (file)
@@ -1,3 +1,43 @@
+2011-03-23  Kai Tietz  <ktietz@redhat.com>
+
+       * breakpoint.c (clear_command): Use filename_cmp
+       instead of strcmp for comparison.
+       * buildsym.c (watch_main_source_file_lossage): Likewise.
+       (patch_subfile_names): Use IS_DIR_SEPARATOR instead of
+       checking just for slash.
+       * dbxread.c (read_dbx_symtab): Use lbasename instead of
+       strrchr and filename_cmp instead of strcmp for filenames.
+       (add_old_header_file): Use filename_cmp
+       instead of strcmp for comparison.
+       * exec.c (exec_set_section_address): Likewise.
+       * macrotab.c (macro_lookup_inclusion): Likewise.
+       (macro_lookup_inclusion): Likewise.
+       * elfread.c (_initialize_elfread): Likewise.
+       (elfstab_offset_sections): Likewise.
+       (elfstab_offset_sections): Use lbasename instead of
+       strrchr.
+       * mdebugread.c (parse_partial_symbols): Likewise.
+       (arse_partial_symbols): Use filename_(n)cmp instead of
+       str(n)cmp for comparison.
+       * minsyms.c (lookup_minimal_symbol): Likewise.
+       * psymtab.c (read_psymtabs_with_filename): Likewise.
+       * solib.c (solib_read_symbols): Likewise.
+       (reload_shared_libraries_1): Likewise.
+       * symmisc.c (maintenance_print_symbols): Likewise.
+       * symfile.c (separate_debug_file_exists): Likewise.
+       (reread_symbols): Likewise.
+       (find_separate_debug_file_by_debuglink): Likewise.
+       * remote-fileio.c (remote_fileio_func_rename): Likewise.
+       * source.c (add_path): Likewise.
+       * symtab.c (filename_seen): Likewise.
+       (file_matches): Likewise.
+       (print_symbol_info): Likewise.
+       (maybe_add_partial_symtab_filename): Likewise.
+       (make_source_files_completion_list): Likewise.
+       * xml-syscall.c (init_sysinfo): Likewise.
+       * windows-nat.c (_initialize_check_for_gdb_ini): Use
+       IS_DIR_SEPARATOR for checking for trailing path separator.
+
 2011-03-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * dwarf2expr.c (execute_stack_op): Handle DW_OP_GNU_entry_value.  New
index c55e5c06571dec3d246da2d27a7f787e35beb594..70eb8009ef54541bdd061ef9cecb5e19bbe64a3a 100644 (file)
@@ -39,6 +39,7 @@
 #include "language.h"
 #include "gdb_string.h"
 #include "demangle.h"
+#include "filenames.h"
 #include "annotate.h"
 #include "symfile.h"
 #include "objfiles.h"
@@ -9524,8 +9525,8 @@ clear_command (char *arg, int from_tty)
                                    && b->source_file != NULL
                                    && sal.symtab != NULL
                                    && sal.pspace == loc->pspace
-                                   && strcmp (b->source_file,
-                                              sal.symtab->filename) == 0
+                                   && filename_cmp (b->source_file,
+                                                    sal.symtab->filename) == 0
                                    && b->line_number == sal.line);
                  if (pc_match || line_match)
                    {
index 0caa75bac4f83c897a844b4b23fb7451e2d41bc7..cd159a71cd94ccb15e4f2c84029ad2d569d895f1 100644 (file)
@@ -643,7 +643,7 @@ void
 patch_subfile_names (struct subfile *subfile, char *name)
 {
   if (subfile != NULL && subfile->dirname == NULL && subfile->name != NULL
-      && subfile->name[strlen (subfile->name) - 1] == '/')
+      && IS_DIR_SEPARATOR (subfile->name[strlen (subfile->name) - 1]))
     {
       subfile->dirname = subfile->name;
       subfile->name = xstrdup (name);
@@ -878,7 +878,7 @@ watch_main_source_file_lossage (void)
           subfile->next;
           subfile = subfile->next)
        {
-         if (strcmp (lbasename (subfile->name), mainbase) == 0)
+         if (filename_cmp (lbasename (subfile->name), mainbase) == 0)
            {
              ++nr_matches;
              mainsub_alias = subfile;
index 8242cf84dc34f6f3ece23cfe81be42cb487cf700..51ddd9da877f2796204c73f51227ade60a3eae1a 100644 (file)
@@ -47,6 +47,7 @@
 #include "target.h"
 #include "gdbcore.h"           /* for bfd stuff */
 #include "libaout.h"           /* FIXME Secret internal BFD stuff for a.out */
+#include "filenames.h"
 #include "objfiles.h"
 #include "buildsym.h"
 #include "stabsread.h"
@@ -346,7 +347,7 @@ add_old_header_file (char *name, int instance)
   int i;
 
   for (i = 0; i < N_HEADER_FILES (current_objfile); i++)
-    if (strcmp (p[i].name, name) == 0 && instance == p[i].instance)
+    if (filename_cmp (p[i].name, name) == 0 && instance == p[i].instance)
       {
        add_this_object_header_file (i);
        return;
@@ -1465,7 +1466,7 @@ read_dbx_symtab (struct objfile *objfile)
            CORE_ADDR valu;
            static int prev_so_symnum = -10;
            static int first_so_symnum;
-           char *p;
+           const char *p;
            static char *dirname_nso;
            int prev_textlow_not_set;
 
@@ -1522,8 +1523,8 @@ read_dbx_symtab (struct objfile *objfile)
               If pst exists, is empty, and has a filename ending in '/',
               we assume the previous N_SO was a directory name.  */
 
-           p = strrchr (namestring, '/');
-           if (p && *(p + 1) == '\000')
+           p = lbasename (namestring);
+           if (p != namestring && *p == '\000')
              {
                /* Save the directory name SOs locally, then save it into
                   the psymtab when it's created below.  */
@@ -1612,13 +1613,13 @@ read_dbx_symtab (struct objfile *objfile)
               things like "break c-exp.y:435" need to work (I
               suppose the psymtab_include_list could be hashed or put
               in a binary tree, if profiling shows this is a major hog).  */
-           if (pst && strcmp (namestring, pst->filename) == 0)
+           if (pst && filename_cmp (namestring, pst->filename) == 0)
              continue;
            {
              int i;
 
              for (i = 0; i < includes_used; i++)
-               if (strcmp (namestring, psymtab_include_list[i]) == 0)
+               if (filename_cmp (namestring, psymtab_include_list[i]) == 0)
                  {
                    i = -1;
                    break;
index e638a3676939147dc9af910373de04216f08a541..dacc6f054834d933a9ce97c9da8610c1e3b27ce6 100644 (file)
@@ -37,6 +37,7 @@
 #include "complaints.h"
 #include "demangle.h"
 #include "psympriv.h"
+#include "filenames.h"
 
 extern void _initialize_elfread (void);
 
@@ -707,7 +708,8 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
       build_id_name = build_id_to_debug_filename (build_id);
       xfree (build_id);
       /* Prevent looping on a stripped .debug file.  */
-      if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
+      if (build_id_name != NULL
+         && filename_cmp (build_id_name, objfile->name) == 0)
         {
          warning (_("\"%s\": separate debug info file has no debug info"),
                   build_id_name);
@@ -1023,12 +1025,10 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
   struct stab_section_info *maybe = dbx->stab_section_info;
   struct stab_section_info *questionable = 0;
   int i;
-  char *p;
 
   /* The ELF symbol info doesn't include path names, so strip the path
      (if any) from the psymtab filename.  */
-  while (0 != (p = strchr (filename, '/')))
-    filename = p + 1;
+  filename = lbasename (filename);
 
   /* FIXME:  This linear search could speed up significantly
      if it was chained in the right order to match how we search it,
@@ -1036,7 +1036,7 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
   for (; maybe; maybe = maybe->next)
     {
       if (filename[0] == maybe->filename[0]
-         && strcmp (filename, maybe->filename) == 0)
+         && filename_cmp (filename, maybe->filename) == 0)
        {
          /* We found a match.  But there might be several source files
             (from different directories) with the same name.  */
index 383d3010aaefd161ba310cdb2e4e6432a2bf615a..a2da9d5297c1e49e338878e995ca6493fbc54a86 100644 (file)
@@ -25,6 +25,7 @@
 #include "target.h"
 #include "gdbcmd.h"
 #include "language.h"
+#include "filenames.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "completer.h"
@@ -845,7 +846,7 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
   table = current_target_sections;
   for (p = table->sections; p < table->sections_end; p++)
     {
-      if (strcmp (filename, p->bfd->filename) == 0
+      if (filename_cmp (filename, p->bfd->filename) == 0
          && index == p->the_bfd_section->index)
        {
          p->endaddr += address - p->addr;
index 84c53c257fc7da62f9ad21bcd72c02bcbe21a010..cba285dc9dc7174bb7866d9cad585e60bc909dd4 100644 (file)
@@ -21,6 +21,7 @@
 #include "defs.h"
 #include "gdb_obstack.h"
 #include "splay-tree.h"
+#include "filenames.h"
 #include "symtab.h"
 #include "symfile.h"
 #include "objfiles.h"
@@ -500,7 +501,7 @@ struct macro_source_file *
 macro_lookup_inclusion (struct macro_source_file *source, const char *name)
 {
   /* Is SOURCE itself named NAME?  */
-  if (strcmp (name, source->filename) == 0)
+  if (filename_cmp (name, source->filename) == 0)
     return source;
 
   /* The filename in the source structure is probably a full path, but
@@ -510,11 +511,12 @@ macro_lookup_inclusion (struct macro_source_file *source, const char *name)
     int src_name_len = strlen (source->filename);
 
     /* We do mean < here, and not <=; if the lengths are the same,
-       then the strcmp above should have triggered, and we need to
+       then the filename_cmp above should have triggered, and we need to
        check for a slash here.  */
     if (name_len < src_name_len
-        && source->filename[src_name_len - name_len - 1] == '/'
-        && strcmp (name, source->filename + src_name_len - name_len) == 0)
+        && IS_DIR_SEPARATOR (source->filename[src_name_len - name_len - 1])
+        && filename_cmp (name,
+                        source->filename + src_name_len - name_len) == 0)
       return source;
   }
 
index d99ad16eb51e9638ec4a10342283b9d3f3e878d7..e224f19180ae3d2c6877c8d30ad987858fcbf393 100644 (file)
@@ -45,6 +45,7 @@
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "gdbcore.h"
+#include "filenames.h"
 #include "objfiles.h"
 #include "gdb_obstack.h"
 #include "buildsym.h"
@@ -2959,7 +2960,7 @@ parse_partial_symbols (struct objfile *objfile)
                      CORE_ADDR valu;
                      static int prev_so_symnum = -10;
                      static int first_so_symnum;
-                     char *p;
+                     const char *p;
                      int prev_textlow_not_set;
 
                      valu = sh.value + ANOFFSET (objfile->section_offsets,
@@ -3012,9 +3013,8 @@ parse_partial_symbols (struct objfile *objfile)
                         the second the file name.  If pst exists, is
                         empty, and has a filename ending in '/', we assume
                         the previous N_SO was a directory name.  */
-
-                     p = strrchr (namestring, '/');
-                     if (p && *(p + 1) == '\000')
+                     p = lbasename (namestring);
+                     if (p != namestring && *p == '\000')
                        continue;               /* Simply ignore directory
                                                   name SOs.  */
 
@@ -3065,15 +3065,15 @@ parse_partial_symbols (struct objfile *objfile)
                         work (I suppose the psymtab_include_list could be
                         hashed or put in a binary tree, if profiling shows
                         this is a major hog).  */
-                     if (pst && strcmp (namestring, pst->filename) == 0)
+                     if (pst && filename_cmp (namestring, pst->filename) == 0)
                        continue;
 
                      {
                        int i;
 
                        for (i = 0; i < includes_used; i++)
-                         if (strcmp (namestring,
-                                     psymtab_include_list[i]) == 0)
+                         if (filename_cmp (namestring,
+                                           psymtab_include_list[i]) == 0)
                            {
                              i = -1;
                              break;
index 4ae7f2793934db88a266ad644429721a972defb9..4551b078adf135e7676f56a91c8a534ae1a63f19 100644 (file)
@@ -43,6 +43,7 @@
 #include "gdb_string.h"
 #include "symtab.h"
 #include "bfd.h"
+#include "filenames.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "demangle.h"
@@ -255,7 +256,7 @@ lookup_minimal_symbol (const char *name, const char *sfile,
                       case mst_file_data:
                       case mst_file_bss:
                         if (sfile == NULL
-                           || strcmp (msymbol->filename, sfile) == 0)
+                           || filename_cmp (msymbol->filename, sfile) == 0)
                           found_file_symbol = msymbol;
                         break;
 
index edd476eb4a52de991293501f419a5390a8fbc972..a402a5da6f60246abe4836b8b843a3808dd5fc0d 100644 (file)
@@ -1067,7 +1067,7 @@ read_psymtabs_with_filename (struct objfile *objfile, const char *filename)
 
   ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, p)
     {
-      if (strcmp (filename, p->filename) == 0)
+      if (filename_cmp (filename, p->filename) == 0)
        PSYMTAB_TO_SYMTAB (p);
     }
 }
@@ -1735,7 +1735,7 @@ print-psymbols takes an output file name and optional symbol file name"));
 
   immediate_quit++;
   ALL_PSYMTABS (objfile, ps)
-    if (symname == NULL || strcmp (symname, ps->filename) == 0)
+    if (symname == NULL || filename_cmp (symname, ps->filename) == 0)
     dump_psymtab (objfile, ps, outfile);
   immediate_quit--;
   do_cleanups (cleanups);
index 7338b97fb90f557eb5d6b96a4db380766c093b19..68298e78628b8758decab733433cbff40a29efed 100644 (file)
@@ -31,6 +31,7 @@
 #include "remote-fileio.h"
 #include "event-loop.h"
 #include "target.h"
+#include "filenames.h"
 
 #include <fcntl.h>
 #include <sys/time.h>
@@ -1020,8 +1021,8 @@ remote_fileio_func_rename (char *buf)
                  cygwin_conv_path (CCP_WIN_A_TO_POSIX, newpath, newfullpath,
                                    PATH_MAX);
                  len = strlen (oldfullpath);
-                 if (newfullpath[len] == '/'
-                     && !strncmp (oldfullpath, newfullpath, len))
+                 if (IS_DIR_SEPARATOR (newfullpath[len])
+                     && !filename_ncmp (oldfullpath, newfullpath, len))
                    errno = EINVAL;
                  else
                    errno = EEXIST;
index 2bf0751399e4c9e815624d709d3e17fdf91c4760..819eb7dab75d16fb752e62b1f88ee34dfe19ce05 100644 (file)
@@ -638,7 +638,7 @@ solib_read_symbols (struct so_list *so, int flags)
          /* Have we already loaded this shared object?  */
          ALL_OBJFILES (so->objfile)
            {
-             if (strcmp (so->objfile->name, so->so_name) == 0
+             if (filename_cmp (so->objfile->name, so->so_name) == 0
                  && so->objfile->addr_low == so->addr_low)
                break;
            }
@@ -762,7 +762,7 @@ update_solib_list (int from_tty, struct target_ops *target)
            }
          else
            {
-             if (! strcmp (gdb->so_original_name, i->so_original_name))
+             if (! filename_cmp (gdb->so_original_name, i->so_original_name))
                break;        
            }
 
@@ -1339,7 +1339,7 @@ reload_shared_libraries_1 (int from_tty)
         symbol file, close that.  */
       if ((found_pathname == NULL && was_loaded)
          || (found_pathname != NULL
-             && strcmp (found_pathname, so->so_name) != 0))
+             && filename_cmp (found_pathname, so->so_name) != 0))
        {
          if (so->objfile && ! (so->objfile->flags & OBJF_USERLOADED))
            free_objfile (so->objfile);
@@ -1351,7 +1351,7 @@ reload_shared_libraries_1 (int from_tty)
         file, open it.  */
       if (found_pathname != NULL
          && (!was_loaded
-             || strcmp (found_pathname, so->so_name) != 0))
+             || filename_cmp (found_pathname, so->so_name) != 0))
        {
          volatile struct gdb_exception e;
 
index 391c9c260a587493d84d9157dbb921181b1c5814..5710f14d3d3a6bda7ad4e278d496a4d94eed59f7 100644 (file)
@@ -569,15 +569,10 @@ add_path (char *dirname, char **which_path, int parse_separators)
        p = *which_path;
        while (1)
          {
-           /* FIXME: strncmp loses in interesting ways on MS-DOS and
-              MS-Windows because of case-insensitivity and two different
-              but functionally identical slash characters.  We need a
-              special filesystem-dependent file-name comparison function.
-
-              Actually, even on Unix I would use realpath() or its work-
-              alike before comparing.  Then all the code above which
+           /* FIXME: we should use realpath() or its work-alike
+              before comparing.  Then all the code above which
               removes excess slashes and dots could simply go away.  */
-           if (!strncmp (p, name, len)
+           if (!filename_ncmp (p, name, len)
                && (p[len] == '\0' || p[len] == DIRNAME_SEPARATOR))
              {
                /* Found it in the search path, remove old copy.  */
index 06b5deccca15062a67f7c06820969aad61d7fd9c..1478c83c03b2903777a84fc6741731593902e595 100644 (file)
@@ -1325,7 +1325,7 @@ separate_debug_file_exists (const char *name, unsigned long crc,
      ".debug" suffix as "/usr/lib/debug/path/to/file" is a separate tree where
      the separate debug infos with the same basename can exist.  */
 
-  if (strcmp (name, parent_objfile->name) == 0)
+  if (filename_cmp (name, parent_objfile->name) == 0)
     return 0;
 
   abfd = bfd_open_maybe_remote (name);
@@ -1333,7 +1333,7 @@ separate_debug_file_exists (const char *name, unsigned long crc,
   if (!abfd)
     return 0;
 
-  /* Verify symlinks were not the cause of strcmp name difference above.
+  /* Verify symlinks were not the cause of filename_cmp name difference above.
 
      Some operating systems, e.g. Windows, do not provide a meaningful
      st_ino; they always set it to zero.  (Windows does provide a
@@ -1471,7 +1471,8 @@ find_separate_debug_file_by_debuglink (struct objfile *objfile)
       /* If the file is in the sysroot, try using its base path in the
         global debugfile directory.  */
       if (canon_name
-         && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
+         && filename_ncmp (canon_name, gdb_sysroot,
+                           strlen (gdb_sysroot)) == 0
          && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
        {
          memcpy (debugfile, debugdir, debugdir_end - debugdir);
@@ -2375,8 +2376,9 @@ reread_symbols (void)
          /* We need to do this whenever any symbols go away.  */
          make_cleanup (clear_symtab_users_cleanup, 0 /*ignore*/);
 
-         if (exec_bfd != NULL && strcmp (bfd_get_filename (objfile->obfd),
-                                         bfd_get_filename (exec_bfd)) == 0)
+         if (exec_bfd != NULL
+             && filename_cmp (bfd_get_filename (objfile->obfd),
+                              bfd_get_filename (exec_bfd)) == 0)
            {
              /* Reload EXEC_BFD without asking anything.  */
 
index 4be81069a946acec97de20b94172e01f8de04ac7..74e49414cbec7b5f144c2ce938fe709e272ab8de 100644 (file)
@@ -23,6 +23,7 @@
 #include "symtab.h"
 #include "gdbtypes.h"
 #include "bfd.h"
+#include "filenames.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "breakpoint.h"
@@ -475,7 +476,7 @@ maintenance_print_symbols (char *args, int from_tty)
 
   immediate_quit++;
   ALL_SYMTABS (objfile, s)
-    if (symname == NULL || strcmp (symname, s->filename) == 0)
+    if (symname == NULL || filename_cmp (symname, s->filename) == 0)
     dump_symtab (objfile, s, outfile);
   immediate_quit--;
   do_cleanups (cleanups);
index 60bc585fcc42980fa37c055129e3302298a37b69..d15f910638cc79d753904153f7ad47aefcaf0f38 100644 (file)
@@ -2761,7 +2761,7 @@ filename_seen (const char *file, int add, int *first)
 
   /* Is FILE in tab?  */
   for (p = tab; p < tab + tab_cur_size; p++)
-    if (strcmp (*p, file) == 0)
+    if (filename_cmp (*p, file) == 0)
       return 1;
 
   /* No; maybe add it to tab.  */
@@ -2862,7 +2862,7 @@ file_matches (const char *file, char *files[], int nfiles)
     {
       for (i = 0; i < nfiles; i++)
        {
-         if (strcmp (files[i], lbasename (file)) == 0)
+         if (filename_cmp (files[i], lbasename (file)) == 0)
            return 1;
        }
     }
@@ -3260,7 +3260,7 @@ static void
 print_symbol_info (domain_enum kind, struct symtab *s, struct symbol *sym,
                   int block, char *last)
 {
-  if (last == NULL || strcmp (last, s->filename) != 0)
+  if (last == NULL || filename_cmp (last, s->filename) != 0)
     {
       fputs_filtered ("\nFile ", gdb_stdout);
       fputs_filtered (s->filename, gdb_stdout);
@@ -4073,7 +4073,7 @@ not_interesting_fname (const char *fname)
 
   for (i = 0; illegal_aliens[i]; i++)
     {
-      if (strcmp (fname, illegal_aliens[i]) == 0)
+      if (filename_cmp (fname, illegal_aliens[i]) == 0)
        return 1;
     }
   return 0;
@@ -4102,12 +4102,7 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
   if (not_interesting_fname (filename))
     return;
   if (!filename_seen (filename, 1, data->first)
-#if HAVE_DOS_BASED_FILE_SYSTEM
-      && strncasecmp (filename, data->text, data->text_len) == 0
-#else
-      && strncmp (filename, data->text, data->text_len) == 0
-#endif
-      )
+      && filename_ncmp (filename, data->text, data->text_len) == 0)
     {
       /* This file matches for a completion; add it to the
         current list of matches.  */
@@ -4120,12 +4115,7 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
 
       if (base_name != filename
          && !filename_seen (base_name, 1, data->first)
-#if HAVE_DOS_BASED_FILE_SYSTEM
-         && strncasecmp (base_name, data->text, data->text_len) == 0
-#else
-         && strncmp (base_name, data->text, data->text_len) == 0
-#endif
-         )
+         && filename_ncmp (base_name, data->text, data->text_len) == 0)
        add_filename_to_list (base_name, data->text, data->word,
                              data->list, data->list_used, data->list_alloced);
     }
@@ -4159,12 +4149,7 @@ make_source_files_completion_list (char *text, char *word)
       if (not_interesting_fname (s->filename))
        continue;
       if (!filename_seen (s->filename, 1, &first)
-#if HAVE_DOS_BASED_FILE_SYSTEM
-         && strncasecmp (s->filename, text, text_len) == 0
-#else
-         && strncmp (s->filename, text, text_len) == 0
-#endif
-         )
+         && filename_ncmp (s->filename, text, text_len) == 0)
        {
          /* This file matches for a completion; add it to the current
             list of matches.  */
@@ -4180,12 +4165,7 @@ make_source_files_completion_list (char *text, char *word)
          base_name = lbasename (s->filename);
          if (base_name != s->filename
              && !filename_seen (base_name, 1, &first)
-#if HAVE_DOS_BASED_FILE_SYSTEM
-             && strncasecmp (base_name, text, text_len) == 0
-#else
-             && strncmp (base_name, text, text_len) == 0
-#endif
-             )
+             && filename_ncmp (base_name, text, text_len) == 0)
            add_filename_to_list (base_name, text, word,
                                  &list, &list_used, &list_alloced);
        }
index fd8ce10c02f2ac490e63141ec7e0060192c6f0a7..4334755fee1d28144485288070c081b452138d9e 100644 (file)
@@ -46,6 +46,7 @@
 #include <signal.h>
 
 #include "buildsym.h"
+#include "filenames.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "gdb_obstack.h"
@@ -2586,7 +2587,7 @@ _initialize_check_for_gdb_ini (void)
                                      sizeof ("/gdb.ini"));
       strcpy (oldini, homedir);
       p = strchr (oldini, '\0');
-      if (p > oldini && p[-1] != '/')
+      if (p > oldini && !IS_DIR_SEPARATOR (p[-1]))
        *p++ = '/';
       strcpy (p, "gdb.ini");
       if (access (oldini, 0) == 0)
index 369fb73058b6e1f9ecd0c02a0d937f5041e7bf1c..d4261966503480df1ef891270f76d7ffdce5e79b 100644 (file)
@@ -281,7 +281,7 @@ static void
 init_sysinfo (void)
 {
   /* Should we re-read the XML info for this target?  */
-  if (my_gdb_datadir && strcmp (my_gdb_datadir, gdb_datadir) != 0)
+  if (my_gdb_datadir && filename_cmp (my_gdb_datadir, gdb_datadir) != 0)
     {
       /* The data-directory changed from the last time we used it.
         It means that we have to re-read the XML info.  */