summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-02-14 16:25:56 -0500
committerPeter Zhu <[email protected]>2024-02-15 11:48:31 -0500
commite779c194b3520973e42e277ed4759a90b97795d0 (patch)
tree662bc1f98dd6d85204af2d6104ff42251715d822 /io.c
parenta6bcd3aa70894858d0b75051a471896794efab61 (diff)
Remove used str field in struct binwrite_arg
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/io.c b/io.c
index 36e2fe5057..4c05b7513d 100644
--- a/io.c
+++ b/io.c
@@ -1704,7 +1704,6 @@ make_writeconv(rb_io_t *fptr)
/* writing functions */
struct binwrite_arg {
rb_io_t *fptr;
- VALUE str;
const char *ptr;
long length;
};
@@ -1854,7 +1853,7 @@ io_binwrite_requires_flush_write(rb_io_t *fptr, long len, int nosync)
}
static long
-io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
+io_binwrite(const char *ptr, long len, rb_io_t *fptr, int nosync)
{
if (len <= 0) return len;
@@ -1867,7 +1866,6 @@ io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
struct binwrite_arg arg;
arg.fptr = fptr;
- arg.str = str;
arg.ptr = ptr;
arg.length = len;
@@ -1977,7 +1975,7 @@ io_fwrite(VALUE str, rb_io_t *fptr, int nosync)
tmp = rb_str_tmp_frozen_no_embed_acquire(str);
RSTRING_GETMEM(tmp, ptr, len);
- n = io_binwrite(tmp, ptr, len, fptr, nosync);
+ n = io_binwrite(ptr, len, fptr, nosync);
rb_str_tmp_frozen_release(str, tmp);
return n;
@@ -1990,7 +1988,7 @@ rb_io_bufwrite(VALUE io, const void *buf, size_t size)
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
- return (ssize_t)io_binwrite(0, buf, (long)size, fptr, 0);
+ return (ssize_t)io_binwrite(buf, (long)size, fptr, 0);
}
static VALUE
@@ -13235,7 +13233,7 @@ copy_stream_body(VALUE arg)
rb_str_resize(str,len);
read_buffered_data(RSTRING_PTR(str), len, stp->src_fptr);
if (stp->dst_fptr) { /* IO or filename */
- if (io_binwrite(str, RSTRING_PTR(str), RSTRING_LEN(str), stp->dst_fptr, 0) < 0)
+ if (io_binwrite(RSTRING_PTR(str), RSTRING_LEN(str), stp->dst_fptr, 0) < 0)
rb_sys_fail_on_write(stp->dst_fptr);
}
else /* others such as StringIO */