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:
parent
07a3df0100
commit
401cd90a90
4 changed files with 21 additions and 4 deletions
|
@ -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>
|
2005-11-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||||
|
|
||||||
PR libgfortran/25109
|
PR libgfortran/25109
|
||||||
|
|
|
@ -54,6 +54,7 @@ PREFIX(fgetc) (const int * unit, char * c, gfc_charlen_type c_len)
|
||||||
s = 1;
|
s = 1;
|
||||||
memset (c, ' ', c_len);
|
memset (c, ' ', c_len);
|
||||||
ret = sread (u->s, c, &s);
|
ret = sread (u->s, c, &s);
|
||||||
|
unlock_unit (u);
|
||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -118,13 +119,16 @@ PREFIX(fputc) (const int * unit, char * c,
|
||||||
gfc_charlen_type c_len __attribute__((unused)))
|
gfc_charlen_type c_len __attribute__((unused)))
|
||||||
{
|
{
|
||||||
size_t s;
|
size_t s;
|
||||||
|
int ret;
|
||||||
gfc_unit * u = find_unit (*unit);
|
gfc_unit * u = find_unit (*unit);
|
||||||
|
|
||||||
if (u == NULL)
|
if (u == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
s = 1;
|
s = 1;
|
||||||
return swrite (u->s, c, &s);
|
ret = swrite (u->s, c, &s);
|
||||||
|
unlock_unit (u);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,12 @@ size_t
|
||||||
PREFIX(ftell) (int * unit)
|
PREFIX(ftell) (int * unit)
|
||||||
{
|
{
|
||||||
gfc_unit * u = find_unit (*unit);
|
gfc_unit * u = find_unit (*unit);
|
||||||
|
size_t ret;
|
||||||
if (u == NULL)
|
if (u == NULL)
|
||||||
return ((size_t) -1);
|
return ((size_t) -1);
|
||||||
else
|
ret = (size_t) stream_offset (u->s);
|
||||||
return ((size_t) stream_offset (u->s));
|
unlock_unit (u);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FTELL_SUB(kind) \
|
#define FTELL_SUB(kind) \
|
||||||
|
@ -58,7 +60,10 @@ PREFIX(ftell) (int * unit)
|
||||||
if (u == NULL) \
|
if (u == NULL) \
|
||||||
*offset = -1; \
|
*offset = -1; \
|
||||||
else \
|
else \
|
||||||
|
{ \
|
||||||
*offset = stream_offset (u->s); \
|
*offset = stream_offset (u->s); \
|
||||||
|
unlock_unit (u); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
FTELL_SUB(1)
|
FTELL_SUB(1)
|
||||||
|
|
|
@ -121,8 +121,10 @@ ttynam (char ** name, gfc_charlen_type * name_len, int unit)
|
||||||
{
|
{
|
||||||
*name_len = strlen (*name);
|
*name_len = strlen (*name);
|
||||||
*name = strdup (*name);
|
*name = strdup (*name);
|
||||||
|
unlock_unit (u);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
unlock_unit (u);
|
||||||
}
|
}
|
||||||
|
|
||||||
*name_len = 0;
|
*name_len = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue