ftell.c (ftell, FTELL_SUB): Add unlock_unit call.

* intrinsics/ftell.c (ftell, FTELL_SUB): Add unlock_unit call.
	* intrinsics/fget.c (fgetc, fputs): Likewise.
	* intrinsics/tty.c (ttynam): Likewise.

From-SVN: r107595
This commit is contained in:
Jakub Jelinek 2005-11-28 08:16:33 +01:00 committed by Jakub Jelinek
parent 07a3df0100
commit 401cd90a90
4 changed files with 21 additions and 4 deletions

View 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

View 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;
}

View 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)

View 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;