Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions doc/box.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ class Something
end
```

Classes/modules, those methods and constants defined in the box can be accessed via `ns` object.
Classes/modules, those methods and constants defined in the box can be accessed via `box` object.

```ruby
p ns::Something.x # 1

X = 2
p X # 2
p ::X # 2
p X # 2
p ::X # 2
p box::Something.x # 1
p box::X # 1
```
Expand Down
174 changes: 0 additions & 174 deletions doc/command_line/environment.md

This file was deleted.

29 changes: 8 additions & 21 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3156,8 +3156,6 @@ io_enc_str(VALUE str, rb_io_t *fptr)
return str;
}

static rb_encoding *io_read_encoding(rb_io_t *fptr);

static void
make_readconv(rb_io_t *fptr, int size)
{
Expand Down Expand Up @@ -4900,7 +4898,7 @@ static VALUE
rb_io_each_codepoint(VALUE io)
{
rb_io_t *fptr;
rb_encoding *enc, *read_enc;
rb_encoding *enc;
unsigned int c;
int r, n;

Expand All @@ -4909,20 +4907,17 @@ rb_io_each_codepoint(VALUE io)
rb_io_check_char_readable(fptr);

READ_CHECK(fptr);
enc = io_read_encoding(fptr);
if (NEED_READCONV(fptr)) {
SET_BINARY_MODE(fptr);
r = 1; /* no invalid char yet */
for (;;) {
make_readconv(fptr, 0);
read_enc = io_read_encoding(fptr);
for (;;) {
if (fptr->cbuf.len) {
if (read_enc)
r = rb_enc_precise_mbclen(fptr->cbuf.ptr+fptr->cbuf.off,
fptr->cbuf.ptr+fptr->cbuf.off+fptr->cbuf.len,
read_enc);
else
r = ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(1);
r = rb_enc_precise_mbclen(fptr->cbuf.ptr+fptr->cbuf.off,
fptr->cbuf.ptr+fptr->cbuf.off+fptr->cbuf.len,
enc);
if (!MBCLEN_NEEDMORE_P(r))
break;
if (fptr->cbuf.len == fptr->cbuf.capa) {
Expand All @@ -4932,33 +4927,25 @@ rb_io_each_codepoint(VALUE io)
if (more_char(fptr) == MORE_CHAR_FINISHED) {
clear_readconv(fptr);
if (!MBCLEN_CHARFOUND_P(r)) {
enc = read_enc;
goto invalid;
}
return io;
}
}
if (MBCLEN_INVALID_P(r)) {
enc = read_enc;
goto invalid;
}
n = MBCLEN_CHARFOUND_LEN(r);
if (read_enc) {
c = rb_enc_codepoint(fptr->cbuf.ptr+fptr->cbuf.off,
fptr->cbuf.ptr+fptr->cbuf.off+fptr->cbuf.len,
read_enc);
}
else {
c = (unsigned char)fptr->cbuf.ptr[fptr->cbuf.off];
}
c = rb_enc_codepoint(fptr->cbuf.ptr+fptr->cbuf.off,
fptr->cbuf.ptr+fptr->cbuf.off+fptr->cbuf.len,
enc);
fptr->cbuf.off += n;
fptr->cbuf.len -= n;
rb_yield(UINT2NUM(c));
rb_io_check_char_readable(fptr);
}
}
NEED_NEWLINE_DECORATOR_ON_READ_CHECK(fptr);
enc = io_input_encoding(fptr);
while (io_fillbuf(fptr) >= 0) {
r = rb_enc_precise_mbclen(fptr->rbuf.ptr+fptr->rbuf.off,
fptr->rbuf.ptr+fptr->rbuf.off+fptr->rbuf.len, enc);
Expand Down