diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-24 07:34:07 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-24 07:34:07 +0000 |
| commit | 8b5a217c87b557ae45cc57189a0417082d7ff951 (patch) | |
| tree | 23a7d3a752ad0c5401a148d2a83bb765656e7f06 | |
| parent | 4e3ee05a0b9db5654de0bc52c2d5ada05500beb0 (diff) | |
| download | ruby-8b5a217c87b557ae45cc57189a0417082d7ff951.tar.gz ruby-8b5a217c87b557ae45cc57189a0417082d7ff951.tar.xz ruby-8b5a217c87b557ae45cc57189a0417082d7ff951.zip | |
* io.c (rb_io_getline_fast): the end point of left_char_head()
must be the last character. [ruby-cvs:22445]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | io.c | 4 |
2 files changed, 8 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Thu Jan 24 16:31:04 2008 Yukihiro Matsumoto <matz@ruby-lang.org> + + * io.c (rb_io_getline_fast): the end point of left_char_head() + must be the last character. [ruby-cvs:22445] + Thu Jan 24 16:24:25 2008 NAKAMURA Usaku <usa@ruby-lang.org> * parse.y (reg_fragment_setenc_gen): recognize regexp with option n as @@ -1799,12 +1799,14 @@ rb_io_getline_fast(rb_io_t *fptr) if (pending > 0) { const char *p = READ_DATA_PENDING_PTR(fptr); + const char *pend = p + pending - 1; const char *e; e = memchr(p, '\n', pending); if (e) { const char *p0 = rb_enc_left_char_head(p, e, enc); - const char *pend = rb_enc_left_char_head(p, p+pending, enc); + + pend = rb_enc_left_char_head(p0, pend, enc); if (rb_enc_is_newline(p0, pend, enc)) { pending = p0 - p + rb_enc_mbclen(p0, pend, enc); } |
