]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ftell.c (ftell, FTELL_SUB): Add unlock_unit call.
authorJakub Jelinek <jakub@redhat.com>
Mon, 28 Nov 2005 07:16:33 +0000 (08:16 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 28 Nov 2005 07:16:33 +0000 (08:16 +0100)
* intrinsics/ftell.c (ftell, FTELL_SUB): Add unlock_unit call.
* intrinsics/fget.c (fgetc, fputs): Likewise.
* intrinsics/tty.c (ttynam): Likewise.

From-SVN: r107595

libgfortran/ChangeLog
libgfortran/intrinsics/fget.c
libgfortran/intrinsics/ftell.c
libgfortran/intrinsics/tty.c

index 216a0a70f5dc2f9ea1a343855d971d8b22b17454..b874dc57819e08e865531745d1f35ca752c73881 100644 (file)
@@ -1,3 +1,9 @@
+2005-11-28  Jakub Jelinek  <jakub@redhat.com>
+
+       * intrinsics/ftell.c (ftell, FTELL_SUB): Add unlock_unit call.
+       * intrinsics/fget.c (fgetc, fputs): Likewise.
+       * intrinsics/tty.c (ttynam): Likewise.
+
 2005-11-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libgfortran/25109
index 8eb96e3b98d8c0bd8b74d7d67670d3231a8096fa..5c87ae6c3c11e0db40309b331a8385690bb12851 100644 (file)
@@ -54,6 +54,7 @@ PREFIX(fgetc) (const int * unit, char * c, gfc_charlen_type c_len)
   s = 1;
   memset (c, ' ', c_len);
   ret = sread (u->s, c, &s);
+  unlock_unit (u);
 
   if (ret != 0)
     return ret;
@@ -118,13 +119,16 @@ PREFIX(fputc) (const int * unit, char * c,
               gfc_charlen_type c_len __attribute__((unused)))
 {
   size_t s;
+  int ret;
   gfc_unit * u = find_unit (*unit);
 
   if (u == NULL)
     return -1;
 
   s = 1;
-  return swrite (u->s, c, &s);
+  ret = swrite (u->s, c, &s);
+  unlock_unit (u);
+  return ret;
 }
 
 
index 16cf275c4dc616513b2bc39bf304b029493bda36..311f070cd16037b8c0fcd7f8f71b97d3877f3316 100644 (file)
@@ -42,10 +42,12 @@ size_t
 PREFIX(ftell) (int * unit)
 {
   gfc_unit * u = find_unit (*unit);
+  size_t ret;
   if (u == NULL)
     return ((size_t) -1);
-  else
-    return ((size_t) stream_offset (u->s));
+  ret = (size_t) stream_offset (u->s);
+  unlock_unit (u);
+  return ret;
 }
 
 #define FTELL_SUB(kind) \
@@ -58,7 +60,10 @@ PREFIX(ftell) (int * unit)
     if (u == NULL) \
       *offset = -1; \
     else \
-      *offset = stream_offset (u->s); \
+      { \
+       *offset = stream_offset (u->s); \
+       unlock_unit (u); \
+      } \
   }
 
 FTELL_SUB(1)
index 63c2a5e6d76d0a772dfdbb067554668d1f8a2298..93416f9983c2a9a49aec55e6cd0f28f892297420 100644 (file)
@@ -121,8 +121,10 @@ ttynam (char ** name, gfc_charlen_type * name_len, int unit)
        {
          *name_len = strlen (*name);
          *name = strdup (*name);
+         unlock_unit (u);
          return;
        }
+      unlock_unit (u);
     }
 
   *name_len = 0;