1/* Thread/recursion locking
2   Copyright (C) 2002-2022 Free Software Foundation, Inc.
3   Contributed by Paul Brook <paul@nowt.org> and Andy Vaught
4
5This file is part of the GNU Fortran runtime library (libgfortran).
6
7Libgfortran is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public
9License as published by the Free Software Foundation; either
10version 3 of the License, or (at your option) any later version.
11
12Libgfortran is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24<http://www.gnu.org/licenses/>.  */
25
26#include "io.h"
27#include <string.h>
28
29/* library_start()-- Called with a library call is entered.  */
30
31void
32library_start (st_parameter_common *cmp)
33{
34  if ((cmp->flags & IOPARM_LIBRETURN_ERROR) != 0)
35    return;
36
37  cmp->flags &= ~IOPARM_LIBRETURN_MASK;
38}
39
40
41void
42free_ionml (st_parameter_dt *dtp)
43{
44  namelist_info *t1, *t2;
45
46  /* Delete the namelist, if it exists.  */
47
48  if (dtp->u.p.ionml != NULL)
49    {
50      t1 = dtp->u.p.ionml;
51      while (t1 != NULL)
52	{
53	  t2 = t1;
54	  t1 = t1->next;
55	  free (t2->var_name);
56	  if (t2->var_rank)
57	    {
58	     free (t2->dim);
59	     free (t2->ls);
60	    }
61	  free (t2);
62	}
63    }
64  dtp->u.p.ionml = NULL;
65}
66