backport: re PR libfortran/78549 (Very slow formatted internal file output)
2017-11-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> Backport from trunk PR libgfortran/78549 * io/io.h (newunit_free): Add declaration. Clean some whitespace. * io/transfer.c (st_read_done, st_write_done): Call newunit_free. * io/unit.c (newunit_free): Change type from static void to void. From-SVN: r255108
This commit is contained in:
parent
83d51b3e9c
commit
5ed479711f
|
@ -1,3 +1,11 @@
|
||||||
|
2017-11-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||||
|
|
||||||
|
Backport from trunk
|
||||||
|
PR libgfortran/78549
|
||||||
|
* io/io.h (newunit_free): Add declaration. Clean some whitespace.
|
||||||
|
* io/transfer.c (st_read_done, st_write_done): Call newunit_free.
|
||||||
|
* io/unit.c (newunit_free): Change type from static void to void.
|
||||||
|
|
||||||
2017-10-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
2017-10-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||||
Rimvydas (RJ)
|
Rimvydas (RJ)
|
||||||
|
|
||||||
|
|
|
@ -765,14 +765,16 @@ extern void unlock_unit (gfc_unit *);
|
||||||
internal_proto(unlock_unit);
|
internal_proto(unlock_unit);
|
||||||
|
|
||||||
extern void finish_last_advance_record (gfc_unit *u);
|
extern void finish_last_advance_record (gfc_unit *u);
|
||||||
internal_proto (finish_last_advance_record);
|
internal_proto(finish_last_advance_record);
|
||||||
|
|
||||||
extern int unit_truncate (gfc_unit *, gfc_offset, st_parameter_common *);
|
extern int unit_truncate (gfc_unit *, gfc_offset, st_parameter_common *);
|
||||||
internal_proto (unit_truncate);
|
internal_proto(unit_truncate);
|
||||||
|
|
||||||
extern int newunit_alloc (void);
|
extern int newunit_alloc (void);
|
||||||
internal_proto(newunit_alloc);
|
internal_proto(newunit_alloc);
|
||||||
|
|
||||||
|
extern void newunit_free (int);
|
||||||
|
internal_proto(newunit_free);
|
||||||
|
|
||||||
/* open.c */
|
/* open.c */
|
||||||
|
|
||||||
|
|
|
@ -4084,16 +4084,19 @@ st_read_done (st_parameter_dt *dtp)
|
||||||
if (dtp->u.p.current_unit != NULL
|
if (dtp->u.p.current_unit != NULL
|
||||||
&& dtp->u.p.current_unit->child_dtio == 0)
|
&& dtp->u.p.current_unit->child_dtio == 0)
|
||||||
{
|
{
|
||||||
if (is_internal_unit (dtp) &&
|
if (is_internal_unit (dtp))
|
||||||
(dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
|
{
|
||||||
{
|
if ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
|
||||||
free (dtp->u.p.current_unit->filename);
|
{
|
||||||
dtp->u.p.current_unit->filename = NULL;
|
free (dtp->u.p.current_unit->filename);
|
||||||
free (dtp->u.p.current_unit->s);
|
dtp->u.p.current_unit->filename = NULL;
|
||||||
dtp->u.p.current_unit->s = NULL;
|
free (dtp->u.p.current_unit->s);
|
||||||
if (dtp->u.p.current_unit->ls)
|
dtp->u.p.current_unit->s = NULL;
|
||||||
free (dtp->u.p.current_unit->ls);
|
if (dtp->u.p.current_unit->ls)
|
||||||
dtp->u.p.current_unit->ls = NULL;
|
free (dtp->u.p.current_unit->ls);
|
||||||
|
dtp->u.p.current_unit->ls = NULL;
|
||||||
|
}
|
||||||
|
newunit_free (dtp->common.unit);
|
||||||
}
|
}
|
||||||
if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
|
if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
|
||||||
{
|
{
|
||||||
|
@ -4152,16 +4155,19 @@ st_write_done (st_parameter_dt *dtp)
|
||||||
|
|
||||||
/* If this is a parent WRITE statement we do not need to retain the
|
/* If this is a parent WRITE statement we do not need to retain the
|
||||||
internal unit structure for child use. */
|
internal unit structure for child use. */
|
||||||
if (is_internal_unit (dtp) &&
|
if (is_internal_unit (dtp))
|
||||||
(dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
|
|
||||||
{
|
{
|
||||||
free (dtp->u.p.current_unit->filename);
|
if ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
|
||||||
dtp->u.p.current_unit->filename = NULL;
|
{
|
||||||
free (dtp->u.p.current_unit->s);
|
free (dtp->u.p.current_unit->filename);
|
||||||
dtp->u.p.current_unit->s = NULL;
|
dtp->u.p.current_unit->filename = NULL;
|
||||||
if (dtp->u.p.current_unit->ls)
|
free (dtp->u.p.current_unit->s);
|
||||||
free (dtp->u.p.current_unit->ls);
|
dtp->u.p.current_unit->s = NULL;
|
||||||
dtp->u.p.current_unit->ls = NULL;
|
if (dtp->u.p.current_unit->ls)
|
||||||
|
free (dtp->u.p.current_unit->ls);
|
||||||
|
dtp->u.p.current_unit->ls = NULL;
|
||||||
|
}
|
||||||
|
newunit_free (dtp->common.unit);
|
||||||
}
|
}
|
||||||
if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
|
if (is_internal_unit (dtp) || dtp->u.p.format_not_saved)
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,7 +89,6 @@ static int newunit_size; /* Total number of elements in the newunits array. */
|
||||||
units are allocated, above and equal to the LWI there may be both
|
units are allocated, above and equal to the LWI there may be both
|
||||||
allocated and free units. */
|
allocated and free units. */
|
||||||
static int newunit_lwi;
|
static int newunit_lwi;
|
||||||
static void newunit_free (int);
|
|
||||||
|
|
||||||
/* Unit numbers assigned with NEWUNIT start from here. */
|
/* Unit numbers assigned with NEWUNIT start from here. */
|
||||||
#define NEWUNIT_START -10
|
#define NEWUNIT_START -10
|
||||||
|
@ -911,7 +910,7 @@ newunit_alloc (void)
|
||||||
/* Free a previously allocated newunit= unit number. unit_lock must
|
/* Free a previously allocated newunit= unit number. unit_lock must
|
||||||
be held when calling. */
|
be held when calling. */
|
||||||
|
|
||||||
static void
|
void
|
||||||
newunit_free (int unit)
|
newunit_free (int unit)
|
||||||
{
|
{
|
||||||
int ind = -unit + NEWUNIT_START;
|
int ind = -unit + NEWUNIT_START;
|
||||||
|
|
Loading…
Reference in New Issue