diff options
author | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-02 23:29:27 +0000 |
---|---|---|
committer | kargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-02 23:29:27 +0000 |
commit | 168d017bb23568d49ead4ececfe29fa59fcfeb61 (patch) | |
tree | cbef3e3f5b652593da3a654b71e444f8fc22bc8c /libgfortran/io/unit.c | |
parent | c4841dcd27323b282ed3c6985163b0e3909793d6 (diff) | |
download | gcc-168d017bb23568d49ead4ececfe29fa59fcfeb61.tar.gz |
2007-07-02 Steven G. Kargl <kargl@gcc.gnu.org>
Restore collateral damage from ISO C Binding merge.
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126238 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/unit.c')
-rw-r--r-- | libgfortran/io/unit.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index 9297af08521..fac67bdaf7e 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 +} + |