aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 16:36:14 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 16:36:14 +0000
commita04a812ed0aa7424ea1f40756402d1f199a43308 (patch)
tree9092b223c6ff47b94e637088e56e6ab27f7c2229 /string.c
parent13e239a0120deefd6f2e60345796e282a78ace29 (diff)
downloadruby-a04a812ed0aa7424ea1f40756402d1f199a43308.tar.gz
* include/ruby/encoding.h (rb_enc_left_char_head): new utility macro.
* include/ruby/encoding.h (rb_enc_right_char_head): ditto. * io.c (appendline): does multibyte RS search in the function. * io.c (prepare_getline_args): RS may be nil. * io.c (rb_io_getc): should process character based on external encoding, when transcoding required. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/string.c b/string.c
index fd2c672f1c..6ca4ba3c63 100644
--- a/string.c
+++ b/string.c
@@ -1491,8 +1491,7 @@ rb_str_index(VALUE str, VALUE sub, long offset)
char *t;
pos = rb_memsearch(sptr, slen, s, len);
if (pos < 0) return pos;
- t = (char *)onigenc_get_right_adjust_char_head(enc, (const UChar *)s,
- (const UChar *)s + pos);
+ t = rb_enc_right_char_head(s, s+pos, enc);
if (t == s) break;
if ((len -= t - s) <= 0) return -1;
offset += t - s;
@@ -4564,7 +4563,7 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
if (p[len-1] == newline &&
(rslen <= 1 ||
memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) {
- if (ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, (UChar *)p, (UChar *)pp) != (const UChar*)pp)
+ if (rb_enc_left_char_head(p, pp, enc) != pp)
return Qnil;
rb_str_modify(str);
STR_SET_LEN(str, RSTRING_LEN(str) - rslen);