1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/strscan/strscan.c (strscan_initialize, strscan_getch): use the

encoding of the target string instead of setting to StringScanner
  instance.  [ruby-dev:31831]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-09-24 08:56:24 +00:00
parent 11dc2b9641
commit 7ab48f03e9
2 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,9 @@
Mon Sep 24 17:56:21 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/strscan/strscan.c (strscan_initialize, strscan_getch): use the
encoding of the target string instead of setting to StringScanner
instance. [ruby-dev:31831]
Mon Sep 24 16:52:11 2007 Urabe Shyouhei <shyouhei@ruby-lang.org>
* lib/net/http.rb: fix typo.

View file

@ -190,7 +190,6 @@ strscan_initialize(int argc, VALUE *argv, VALUE self)
rb_scan_args(argc, argv, "11", &str, &need_dup);
StringValue(str);
p->str = str;
rb_enc_associate(self, rb_enc_get(str));
return self;
}
@ -654,14 +653,13 @@ strscan_getch(VALUE self)
{
struct strscanner *p;
long len;
rb_encoding *enc = rb_enc_get(self);
GET_SCANNER(self, p);
CLEAR_MATCH_STATUS(p);
if (EOS_P(p))
return Qnil;
len = rb_enc_mbclen(CURPTR(p), S_PEND(p), enc);
len = rb_enc_mbclen(CURPTR(p), S_PEND(p), rb_enc_get(p->str));
if (p->curr + len > S_LEN(p)) {
len = S_LEN(p) - p->curr;
}