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
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.
+
+
+2007-07-02 Steven G. Kargl <kargl@gcc.gnu.org>
+
* Makefile.in: Regenerated with automake 1.9.6.
2007-07-02 Steven G. Kargl <kargl@gcc.gnu.org>
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);
}
else
return (char *) NULL;
-}
\ No newline at end of file
+}
+