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
This commit is contained in:
Jerry DeLisle 2007-06-29 19:39:21 +00:00
parent 622af87fc8
commit d1d92e95d2
2 changed files with 26 additions and 4 deletions

View File

@ -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

View File

@ -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);
@ -704,3 +719,4 @@ filename_from_unit (int unit_number)
else
return (char *) NULL;
}