diff options
author | Andy Wingo <wingo@pobox.com> | 2017-02-14 21:57:35 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2017-02-14 22:03:21 +0100 |
commit | 69ca2bb2217303b2556b131f3995ca4f6af81234 (patch) | |
tree | a8ef7e23995f35b974db988254aabe5a37c72922 /libguile/deprecated.c | |
parent | 2c02bdda191eecd998c33b00c56752b8ec7378ab (diff) | |
download | guile-69ca2bb2217303b2556b131f3995ca4f6af81234.tar.gz |
Elide syscalls in fdes->port
* libguile/fports.h (scm_t_fport): Add options field.
(SCM_FDES_RANDOM_P): Deprecate.
(scm_i_fdes_to_port): Add options argument.
* libguile/fports.c (scm_i_fdes_to_port): Add options argument. Only
verify FD if SCM_FPORT_OPTION_VERIFY is there.
(scm_fdes_to_port, scm_open_file_with_encoding): Adapt to
scm_i_fdes_to_port changes.
(fport_random_access_p): Don't try to seek if NOT_SEEKABLE option is
set.
* libguile/deprecated.h:
* libguile/deprecated.c (SCM_FDES_RANDOM_P): Deprecate.
* NEWS: Add deprecation.
* libguile/filesys.c:
* libguile/ioext.c:
* libguile/posix.c:
* libguile/read.c:
* libguile/socket.c: Adapt callers.
Diffstat (limited to 'libguile/deprecated.c')
-rw-r--r-- | libguile/deprecated.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libguile/deprecated.c b/libguile/deprecated.c index c3d4935d0..cee6b1d74 100644 --- a/libguile/deprecated.c +++ b/libguile/deprecated.c @@ -26,6 +26,9 @@ #define SCM_BUILDING_DEPRECATED_CODE +#include <sys/types.h> +#include <unistd.h> + #include "libguile/_scm.h" #include "libguile/deprecation.h" @@ -940,6 +943,17 @@ scm_make_dynamic_state (SCM parent) +int +SCM_FDES_RANDOM_P (int fdes) +{ + scm_c_issue_deprecation_warning + ("SCM_FDES_RANDOM_P is deprecated. Use lseek (fd, 0, SEEK_CUR)."); + + return (lseek (fdes, 0, SEEK_CUR) == -1) ? 0 : 1; +} + + + void scm_i_init_deprecated () { |