aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/unit.c')
-rw-r--r--libgfortran/io/unit.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c
index fac67bd..9297af0 100644
--- a/libgfortran/io/unit.c
+++ b/libgfortran/io/unit.c
@@ -690,26 +690,11 @@ update_position (gfc_unit *u)
must free memory allocated for the filename string. */
char *
-filename_from_unit (int n)
+filename_from_unit (int unit_number)
{
char *filename;
- 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. */
+ gfc_unit *u = NULL;
+ u = find_unit (unit_number);
if (u != NULL)
{
filename = (char *) get_mem (u->file_len + 1);
@@ -718,5 +703,4 @@ filename_from_unit (int n)
}
else
return (char *) NULL;
-}
-
+} \ No newline at end of file