mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-29 14:30:34 +02:00
* filesys.c (scm_stat): Slightly optimized.
This commit is contained in:
parent
bfc471e7a1
commit
1ea4704837
2 changed files with 19 additions and 19 deletions
|
@ -1,10 +1,9 @@
|
|||
1997-12-04 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
|
||||
|
||||
* print.h (SCM_COERCE_OUTPORT): Check that the object is a pair
|
||||
before taking the CDR.
|
||||
before taking the CDR. (Thanks to Harald Meland.)
|
||||
|
||||
* filesys.c (scm_stat): Coerce output port only if argument *is*
|
||||
an output port! (Thanks to Harald Meland.)
|
||||
* filesys.c (scm_stat): Slightly optimized.
|
||||
|
||||
Wed Dec 3 12:23:06 1997 Jim Blandy <jimb@totoro.red-bean.com>
|
||||
|
||||
|
|
|
@ -427,24 +427,25 @@ scm_stat (object)
|
|||
struct stat stat_temp;
|
||||
|
||||
SCM_DEFER_INTS;
|
||||
if (SCM_INUMP (object) || (SCM_NIMP (object) && SCM_OPFPORTP (object)))
|
||||
{
|
||||
if (SCM_INUMP (object))
|
||||
fdes = SCM_INUM (object);
|
||||
else
|
||||
{
|
||||
fdes = fileno ((FILE *) SCM_STREAM (SCM_COERCE_OUTPORT (object)));
|
||||
if (fdes == -1)
|
||||
scm_syserror (s_stat);
|
||||
}
|
||||
SCM_SYSCALL (rv = fstat (fdes, &stat_temp));
|
||||
}
|
||||
if (SCM_INUMP (object))
|
||||
SCM_SYSCALL (rv = fstat (SCM_INUM (object), &stat_temp));
|
||||
else
|
||||
{
|
||||
SCM_ASSERT (SCM_NIMP (object) && SCM_ROSTRINGP (object),
|
||||
object, SCM_ARG1, s_stat);
|
||||
SCM_COERCE_SUBSTR (object);
|
||||
SCM_SYSCALL (rv = stat (SCM_ROCHARS (object), &stat_temp));
|
||||
SCM_ASSERT (SCM_NIMP (object), object, SCM_ARG1, s_stat);
|
||||
if (SCM_ROSTRINGP (object))
|
||||
{
|
||||
SCM_COERCE_SUBSTR (object);
|
||||
SCM_SYSCALL (rv = stat (SCM_ROCHARS (object), &stat_temp));
|
||||
}
|
||||
else
|
||||
{
|
||||
object = SCM_COERCE_OUTPORT (object);
|
||||
SCM_ASSERT (SCM_OPFPORTP (object), object, SCM_ARG1, s_stat);
|
||||
fdes = fileno ((FILE *) SCM_STREAM (object));
|
||||
if (fdes == -1)
|
||||
scm_syserror (s_stat);
|
||||
SCM_SYSCALL (rv = fstat (fdes, &stat_temp));
|
||||
}
|
||||
}
|
||||
if (rv == -1)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue