Skip to content

Commit

Permalink
* string.c (rb_enc_str_asciionly_p): use rb_enc_str_coderange.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
akr committed Dec 17, 2007
1 parent 0d0a8a5 commit 33ecb05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Mon Dec 17 17:07:53 2007 Tanaka Akira <[email protected]>

* string.c (rb_enc_str_asciionly_p): use rb_enc_str_coderange.

Mon Dec 17 16:39:25 2007 Tanaka Akira <[email protected]>

* string.c (rb_enc_str_coderange): set ENC_CODERANGE_BROKEN using
Expand Down
13 changes: 3 additions & 10 deletions string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 33ecb05

Please sign in to comment.