2004-10-30 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / source.c
index a55bd33aca945888262fb0d5d66691d8267892b2..f0dc5542b8e387525298cf1beaba0b1605f08e3b 100644 (file)
 #include "ui-out.h"
 #include "readline/readline.h"
 
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
 #ifdef CRLF_SOURCE_FILES
 
 /* Define CRLF_SOURCE_FILES in an xm-*.h file if source files on the
    host use \r\n rather than just \n.  Defining CRLF_SOURCE_FILES is
    much faster than defining LSEEK_NOT_LINEAR.  */
 
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #define OPEN_MODE (O_RDONLY | O_BINARY)
 #define FDOPEN_MODE FOPEN_RB
 
@@ -325,12 +325,12 @@ forget_cached_source_info (void)
        {
          if (s->line_charpos != NULL)
            {
-             xmfree (objfile->md, s->line_charpos);
+             xfree (s->line_charpos);
              s->line_charpos = NULL;
            }
          if (s->fullname != NULL)
            {
-             xmfree (objfile->md, s->fullname);
+             xfree (s->fullname);
              s->fullname = NULL;
            }
        }
@@ -674,9 +674,7 @@ openp (const char *path, int opts, const char *string,
   if (!path)
     path = ".";
 
-#if defined(_WIN32) || defined(__CYGWIN__)
   mode |= O_BINARY;
-#endif
 
   if ((opts & OPF_TRY_CWD_FIRST) || IS_ABSOLUTE_PATH (string))
     {
@@ -851,7 +849,7 @@ find_and_open_source (struct objfile *objfile,
       if (result >= 0)
        return result;
       /* Didn't work -- free old one, try again. */
-      xmfree (objfile->md, *fullname);
+      xfree (*fullname);
       *fullname = NULL;
     }
 
@@ -889,7 +887,7 @@ find_and_open_source (struct objfile *objfile,
     {
       char *tmp_fullname;
       tmp_fullname = *fullname;
-      *fullname = mstrsave (objfile->md, *fullname);
+      *fullname = xstrdup (tmp_fullname);
       xfree (tmp_fullname);
     }
   return result;
This page took 0.064767 seconds and 4 git commands to generate.