extern gfc_unit *get_unit (st_parameter_dt *, int);
internal_proto(get_unit);
-extern void unlock_unit (gfc_unit *);
+extern void unlock_unit(gfc_unit *);
internal_proto(unlock_unit);
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 *);
-internal_proto (unit_truncate);
+extern int unit_truncate(gfc_unit *, gfc_offset, st_parameter_common *);
+internal_proto(unit_truncate);
extern int newunit_alloc (void);
internal_proto(newunit_alloc);
+extern void newunit_free (int);
+internal_proto(newunit_free);
+
/* open.c */
if (dtp->u.p.current_unit != NULL
&& dtp->u.p.current_unit->child_dtio == 0)
{
- if (is_internal_unit (dtp) &&
- (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->s);
- dtp->u.p.current_unit->s = NULL;
- if (dtp->u.p.current_unit->ls)
- free (dtp->u.p.current_unit->ls);
- dtp->u.p.current_unit->ls = NULL;
+ if (is_internal_unit (dtp))
+ {
+ 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->s);
+ dtp->u.p.current_unit->s = 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 this is a parent WRITE statement we do not need to retain the
internal unit structure for child use. */
- if (is_internal_unit (dtp) &&
- (dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0)
+ if (is_internal_unit (dtp))
{
- free (dtp->u.p.current_unit->filename);
- dtp->u.p.current_unit->filename = NULL;
- free (dtp->u.p.current_unit->s);
- dtp->u.p.current_unit->s = NULL;
- if (dtp->u.p.current_unit->ls)
- free (dtp->u.p.current_unit->ls);
- dtp->u.p.current_unit->ls = NULL;
+ 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->s);
+ dtp->u.p.current_unit->s = 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)
{