sim: rl78: rename open symbol to avoid collisions
[deliverable/binutils-gdb.git] / sim / rl78 / trace.c
index cba59e89693cf597cc2ec6cdce15ff98cd57dd18..1b4b365af1e3b707d84d2dca6c412e0ed8281762 100644 (file)
@@ -1,6 +1,6 @@
 /* trace.c --- tracing output for the RL78 simulator.
 
-   Copyright (C) 2005-2020 Free Software Foundation, Inc.
+   Copyright (C) 2005-2021 Free Software Foundation, Inc.
    Contributed by Red Hat, Inc.
 
    This file is part of the GNU simulators.
@@ -19,8 +19,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
@@ -36,6 +37,7 @@
 #include "cpu.h"
 #include "mem.h"
 #include "load.h"
+#include "trace.h"
 
 static disassembler_ftype rl78_disasm_fn = NULL;
 
@@ -138,6 +140,8 @@ load_file_and_line (const char *filename, int lineno)
       int i;
       struct stat s;
       const char *found_filename, *slash;
+      FILE *file;
+      size_t ret;
 
       found_filename = filename;
       while (1)
@@ -155,9 +159,9 @@ load_file_and_line (const char *filename, int lineno)
       files = f;
       f->filename = xstrdup (filename);
       f->data = (char *) xmalloc (s.st_size + 2);
-      FILE *file = fopen (found_filename, "rb");
-      fread (f->data, 1, s.st_size, file);
-      f->data[s.st_size] = 0;
+      file = fopen (found_filename, "rb");
+      ret = fread (f->data, 1, s.st_size, file);
+      f->data[ret] = 0;
       fclose (file);
 
       f->nlines = 1;
This page took 0.023676 seconds and 4 git commands to generate.