summaryrefslogtreecommitdiffstats
path: root/encoding.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-15 18:48:27 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-15 18:48:27 +0000
commitb161530cf2edf8ca1bf5ddc0623b607198e0bb27 (patch)
treee76d7c76d7b7b55a0ac6afd72990e21a789d81cc /encoding.c
parent9da764f1a11f010b90b14cc32e729722559b59e3 (diff)
downloadruby-b161530cf2edf8ca1bf5ddc0623b607198e0bb27.tar.gz
ruby-b161530cf2edf8ca1bf5ddc0623b607198e0bb27.tar.xz
ruby-b161530cf2edf8ca1bf5ddc0623b607198e0bb27.zip
* encoding.c (rb_enc_nth): moved to string.c.
* string.c (rb_enc_nth): moved from string.c. use search_nonascii for ASCII compatible string. (str_nth): wrong optimization removed to fix "a".force_encoding("EUC-JP").slice!(0,10) returns "a\x00\x00\x00\x00\x00\x00\x00\x00\x00" git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/encoding.c b/encoding.c
index 77d3f996d..5a8369b6f 100644
--- a/encoding.c
+++ b/encoding.c
@@ -720,28 +720,6 @@ rb_obj_encoding(VALUE obj)
return rb_enc_from_encoding(enc);
}
-
-char*
-rb_enc_nth(const char *p, const char *e, int nth, rb_encoding *enc)
-{
- int c;
-
- if (rb_enc_mbmaxlen(enc) == 1) {
- p += nth;
- }
- else if (rb_enc_mbmaxlen(enc) == rb_enc_mbminlen(enc)) {
- p += nth * rb_enc_mbmaxlen(enc);
- }
- else {
- for (c=0; p<e && nth--; c++) {
- int n = rb_enc_mbclen(p, e, enc);
-
- p += n;
- }
- }
- return (char*)p;
-}
-
long
rb_enc_strlen(const char *p, const char *e, rb_encoding *enc)
{