aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2007-06-29 19:39:21 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2007-06-29 19:39:21 +0000
commitd1d92e95d2aa6328658b3c98376d16ead427a798 (patch)
tree9d834e3e79a1f4838909083f24defd7289f49d6c
parent622af87fc843e25c9631a43aaa1b30cc647b2825 (diff)
downloadgcc-d1d92e95d2aa6328658b3c98376d16ead427a798.zip
gcc-d1d92e95d2aa6328658b3c98376d16ead427a798.tar.gz
gcc-d1d92e95d2aa6328658b3c98376d16ead427a798.tar.bz2
re PR libfortran/32456 (IO error message should show Unit/Filename)
2007-06-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/32456 * io/unit.c (filename_from_unit): Don't use find_unit, instead search for unit directly. From-SVN: r126119
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/unit.c24
2 files changed, 26 insertions, 4 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index fc8e1ed..0b5afde 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2007-06-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/32456
+ * io/unit.c (filename_from_unit): Don't use find_unit, instead search
+ for unit directly.
+
2007-06-24 Adam Nemet <anemet@caviumnetworks.com>
PR libfortran/32495
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index 9297af0..fac67bd 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -690,11 +690,26 @@ update_position (gfc_unit *u)
must free memory allocated for the filename string. */
char *
-filename_from_unit (int unit_number)
+filename_from_unit (int n)
{
char *filename;
- gfc_unit *u = NULL;
- u = find_unit (unit_number);
+ gfc_unit *u;
+ int c;
+
+ /* Find the unit. */
+ u = unit_root;
+ while (u != NULL)
+ {
+ c = compare (n, u->unit_number);
+ if (c < 0)
+ u = u->left;
+ if (c > 0)
+ u = u->right;
+ if (c == 0)
+ break;
+ }
+
+ /* Get the filename. */
if (u != NULL)
{
filename = (char *) get_mem (u->file_len + 1);
@@ -703,4 +718,5 @@ filename_from_unit (int unit_number)
}
else
return (char *) NULL;
-} \ No newline at end of file
+}
+