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

* string.c (rb_enc_str_asciionly_p): use rb_enc_str_coderange.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-12-17 08:08:23 +00:00
parent 0d0a8a55fc
commit 33ecb05d51
2 changed files with 7 additions and 10 deletions

View file

@ -1,3 +1,7 @@
Mon Dec 17 17:07:53 2007 Tanaka Akira <akr@fsij.org>
* string.c (rb_enc_str_asciionly_p): use rb_enc_str_coderange.
Mon Dec 17 16:39:25 2007 Tanaka Akira <akr@fsij.org> Mon Dec 17 16:39:25 2007 Tanaka Akira <akr@fsij.org>
* string.c (rb_enc_str_coderange): set ENC_CODERANGE_BROKEN using * string.c (rb_enc_str_coderange): set ENC_CODERANGE_BROKEN using

View file

@ -133,16 +133,10 @@ int rb_enc_str_asciionly_p(VALUE str)
{ {
rb_encoding *enc = rb_enc_get(str); rb_encoding *enc = rb_enc_get(str);
if (rb_enc_asciicompat(enc) && if (!rb_enc_asciicompat(enc))
rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) { return Qfalse;
char *ptr = RSTRING_PTR(str); else if (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
long len = RSTRING_LEN(str);
long i;
for (i = 0; i < len; i++)
if (ptr[i] & 0x80)
return Qfalse;
return Qtrue; return Qtrue;
}
return Qfalse; return Qfalse;
} }
@ -1410,7 +1404,6 @@ static VALUE
rb_str_casecmp(VALUE str1, VALUE str2) rb_str_casecmp(VALUE str1, VALUE str2)
{ {
long len; long len;
int retval;
rb_encoding *enc; rb_encoding *enc;
char *p1, *p1end, *p2, *p2end; char *p1, *p1end, *p2, *p2end;