diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-24 08:56:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-24 08:56:24 +0000 |
commit | 7ab48f03e90ed3859ad4e49166bbfd31707e5c91 (patch) | |
tree | 674c99ac960bddb835e796760116d66af28160c8 | |
parent | 11dc2b9641888c2e045f6b86e8189edb905ff3f0 (diff) | |
download | ruby-7ab48f03e90ed3859ad4e49166bbfd31707e5c91.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/strscan/strscan.c | 4 |
2 files changed, 7 insertions, 3 deletions
@@ -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. diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index ac07b39789..fc4a7cf4e1 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -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; } |