diff options
author | Gary Houston <ghouston@arglist.com> | 2001-01-18 22:54:54 +0000 |
---|---|---|
committer | Gary Houston <ghouston@arglist.com> | 2001-01-18 22:54:54 +0000 |
commit | 10288a0948382f088cfb3e81b986db627a647adc (patch) | |
tree | 68ff17e197a285f2783d9945ab65771ad3e1fc61 /libguile/ioext.c | |
parent | 21e39e8fe6a5aefb62a9343d3e7f118c5efd6a44 (diff) | |
download | guile-10288a0948382f088cfb3e81b986db627a647adc.tar.gz |
* ioext.c: further simplify scm_read_string_x_partial by defining
a macro SCM_EBLOCK.
Diffstat (limited to 'libguile/ioext.c')
-rw-r--r-- | libguile/ioext.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/libguile/ioext.c b/libguile/ioext.c index bf757c1ee..894982394 100644 --- a/libguile/ioext.c +++ b/libguile/ioext.c @@ -69,6 +69,22 @@ #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 str, SCM port_or_fdes, SCM start, SCM end), "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)); if (chars_read == -1) { -#if defined (EWOULDBLOCK) || defined (EAGAIN) - if ( -#if defined (EWOULDBLOCK) - errno == EWOULDBLOCK -#else - errno == EAGAIN -#endif - ) + if (SCM_EBLOCK (errno)) chars_read = 0; else -#endif SCM_SYSERROR; } else if (chars_read == 0) |