1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 13:00:26 +02:00

* ioext.c: further simplify scm_read_string_x_partial by defining

a macro	SCM_EBLOCK.
This commit is contained in:
Gary Houston 2001-01-18 22:54:54 +00:00
parent 21e39e8fe6
commit 10288a0948
2 changed files with 22 additions and 9 deletions

View file

@ -1,3 +1,8 @@
2001-01-18 Gary Houston <ghouston@arglist.com>
* ioext.c: further simplify scm_read_string_x_partial by defining
a macro SCM_EBLOCK.
2001-01-18 Dirk Herrmann <D.Herrmann@tu-bs.de> 2001-01-18 Dirk Herrmann <D.Herrmann@tu-bs.de>
* gh_data.c (gh_ints2scm): Simplified using SCM_FIXABLE. * gh_data.c (gh_ints2scm): Simplified using SCM_FIXABLE.

View file

@ -69,6 +69,22 @@
#endif #endif
#if defined (EAGAIN)
#define SCM_MAYBE_EAGAIN || errno == EAGAIN
#else
#define SCM_MAYBE_EAGAIN
#endif
#if defined (EWOULDBLOCK)
#define SCM_MAYBE_EWOULDBLOCK || errno == EWOULDBLOCK
#else
#define SCM_MAYBE_EWOULDBLOCK
#endif
/* MAYBE there is EAGAIN way of defining this macro but now I EWOULDBLOCK. */
#define SCM_EBLOCK(errno) \
(0 SCM_MAYBE_EAGAIN SCM_MAYBE_EWOULDBLOCK)
SCM_DEFINE (scm_read_string_x_partial, "read-string!/partial", 1, 3, 0, SCM_DEFINE (scm_read_string_x_partial, "read-string!/partial", 1, 3, 0,
(SCM str, SCM port_or_fdes, SCM start, SCM end), (SCM str, SCM port_or_fdes, SCM start, SCM end),
"Read characters from an fport or file descriptor into a\n" "Read characters from an fport or file descriptor into a\n"
@ -140,17 +156,9 @@ SCM_DEFINE (scm_read_string_x_partial, "read-string!/partial", 1, 3, 0,
SCM_SYSCALL (chars_read = read (fdes, dest, read_len)); SCM_SYSCALL (chars_read = read (fdes, dest, read_len));
if (chars_read == -1) if (chars_read == -1)
{ {
#if defined (EWOULDBLOCK) || defined (EAGAIN) if (SCM_EBLOCK (errno))
if (
#if defined (EWOULDBLOCK)
errno == EWOULDBLOCK
#else
errno == EAGAIN
#endif
)
chars_read = 0; chars_read = 0;
else else
#endif
SCM_SYSERROR; SCM_SYSERROR;
} }
else if (chars_read == 0) else if (chars_read == 0)