diff --git a/ChangeLog b/ChangeLog index 3623b8a8eb..72e2053690 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Dec 17 17:07:53 2007 Tanaka Akira + + * string.c (rb_enc_str_asciionly_p): use rb_enc_str_coderange. + Mon Dec 17 16:39:25 2007 Tanaka Akira * string.c (rb_enc_str_coderange): set ENC_CODERANGE_BROKEN using diff --git a/string.c b/string.c index 85ea099ea5..8cc6954c02 100644 --- a/string.c +++ b/string.c @@ -133,16 +133,10 @@ int rb_enc_str_asciionly_p(VALUE str) { rb_encoding *enc = rb_enc_get(str); - if (rb_enc_asciicompat(enc) && - rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) { - char *ptr = RSTRING_PTR(str); - long len = RSTRING_LEN(str); - long i; - for (i = 0; i < len; i++) - if (ptr[i] & 0x80) - return Qfalse; + if (!rb_enc_asciicompat(enc)) + return Qfalse; + else if (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) return Qtrue; - } return Qfalse; } @@ -1410,7 +1404,6 @@ static VALUE rb_str_casecmp(VALUE str1, VALUE str2) { long len; - int retval; rb_encoding *enc; char *p1, *p1end, *p2, *p2end;