mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-30 06:50:31 +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>
|
1997-12-04 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
|
||||||
|
|
||||||
* print.h (SCM_COERCE_OUTPORT): Check that the object is a pair
|
* 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*
|
* filesys.c (scm_stat): Slightly optimized.
|
||||||
an output port! (Thanks to Harald Meland.)
|
|
||||||
|
|
||||||
Wed Dec 3 12:23:06 1997 Jim Blandy <jimb@totoro.red-bean.com>
|
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;
|
struct stat stat_temp;
|
||||||
|
|
||||||
SCM_DEFER_INTS;
|
SCM_DEFER_INTS;
|
||||||
if (SCM_INUMP (object) || (SCM_NIMP (object) && SCM_OPFPORTP (object)))
|
if (SCM_INUMP (object))
|
||||||
{
|
SCM_SYSCALL (rv = fstat (SCM_INUM (object), &stat_temp));
|
||||||
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));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCM_ASSERT (SCM_NIMP (object) && SCM_ROSTRINGP (object),
|
SCM_ASSERT (SCM_NIMP (object), object, SCM_ARG1, s_stat);
|
||||||
object, SCM_ARG1, s_stat);
|
if (SCM_ROSTRINGP (object))
|
||||||
SCM_COERCE_SUBSTR (object);
|
{
|
||||||
SCM_SYSCALL (rv = stat (SCM_ROCHARS (object), &stat_temp));
|
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)
|
if (rv == -1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue