зеркало из https://github.com/github/ruby.git
Suppress unused-result warnings
* Hide read function warning in string_spec_RSTRING_PTR_read function * The type of `read` may be `ssize_t` Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
Родитель
e5dd40b1f3
Коммит
9b3fcfbbb9
|
@ -397,12 +397,16 @@ VALUE string_spec_RSTRING_PTR_read(VALUE self, VALUE str, VALUE path) {
|
|||
rb_str_modify_expand(str, 30);
|
||||
rb_ary_push(capacities, SIZET2NUM(rb_str_capacity(str)));
|
||||
char *buffer = RSTRING_PTR(str);
|
||||
read(fd, buffer, 30);
|
||||
if (read(fd, buffer, 30) < 0) {
|
||||
rb_syserr_fail(errno, "read");
|
||||
}
|
||||
|
||||
rb_str_modify_expand(str, 53);
|
||||
rb_ary_push(capacities, SIZET2NUM(rb_str_capacity(str)));
|
||||
char *buffer2 = RSTRING_PTR(str);
|
||||
read(fd, buffer2 + 30, 53 - 30);
|
||||
if (read(fd, buffer2 + 30, 53 - 30) < 0) {
|
||||
rb_syserr_fail(errno, "read");
|
||||
}
|
||||
|
||||
rb_str_set_len(str, 53);
|
||||
close(fd);
|
||||
|
|
Загрузка…
Ссылка в новой задаче