OSDN Git Service

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