summaryrefslogtreecommitdiff
path: root/ext/strscan
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-24 08:56:24 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-24 08:56:24 +0000
commit7ab48f03e90ed3859ad4e49166bbfd31707e5c91 (patch)
tree674c99ac960bddb835e796760116d66af28160c8 /ext/strscan
parent11dc2b9641888c2e045f6b86e8189edb905ff3f0 (diff)
* 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
Diffstat (limited to 'ext/strscan')
-rw-r--r--ext/strscan/strscan.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index ac07b39..fc4a7cf 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;
}