diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2023-05-27 18:48:47 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-27 18:48:47 +0900 |
commit | bf1bc5362e5edb2321665e9ce7c5c4e2e7d9f5ef (patch) | |
tree | 6cd17e5c5f6caafc4471ce3e70b1599403107099 /io.c | |
parent | c37ebfe08fb43242687e58a68628ade8101973d7 (diff) |
Improve `read`/`write`/`pread`/`pwrite` consistency. (#7860)
* Documentation consistency.
* Improve consistency of `pread`/`pwrite` implementation when given length.
* Remove HAVE_PREAD / HAVE_PWRITE - it is no longer optional.
Notes
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 15 |
1 files changed, 0 insertions, 15 deletions
@@ -6071,7 +6071,6 @@ rb_io_sysread(int argc, VALUE *argv, VALUE io) return str; } -#if defined(HAVE_PREAD) || defined(HAVE_PWRITE) struct prdwr_internal_arg { VALUE io; int fd; @@ -6079,9 +6078,7 @@ struct prdwr_internal_arg { size_t count; rb_off_t offset; }; -#endif /* HAVE_PREAD || HAVE_PWRITE */ -#if defined(HAVE_PREAD) static VALUE internal_pread_func(void *_arg) { @@ -6171,11 +6168,7 @@ rb_io_pread(int argc, VALUE *argv, VALUE io) return str; } -#else -# define rb_io_pread rb_f_notimplement -#endif /* HAVE_PREAD */ -#if defined(HAVE_PWRITE) static VALUE internal_pwrite_func(void *_arg) { @@ -6247,9 +6240,6 @@ rb_io_pwrite(VALUE io, VALUE str, VALUE offset) return SSIZET2NUM(n); } -#else -# define rb_io_pwrite rb_f_notimplement -#endif /* HAVE_PWRITE */ VALUE rb_io_binmode(VALUE io) @@ -12918,12 +12908,7 @@ maygvl_copy_stream_read(int has_gvl, struct copy_stream_struct *stp, char *buf, ss = maygvl_read(has_gvl, stp->src_fptr, buf, len); } else { -#ifdef HAVE_PREAD ss = pread(stp->src_fptr->fd, buf, len, offset); -#else - stp->notimp = "pread"; - return -1; -#endif } if (ss == 0) { return 0; |