From 94a0db11e7f286b9d8432814dcc8b857ce129481 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 26 Sep 2007 09:39:08 +0000 Subject: * encoding.c (rb_enc_check): check for ASCII-compatibilities. * parse.y (parser_tokadd_string, parser_parse_string, parser_here_document, parser_yylex): set encoding to US-ASCII. * parse.y (rb_enc_symname_p): check if valid with encoding. * parse.y (rb_intern3): let symbols have encoding. * string.c (rb_str_hash): add encoding index. * string.c (rb_str_comparable, rb_str_equal, rb_str_eql): check if compatible encoding. * string.c (sym_inspect): made encoding aware. * insns.def (opt_eq): compare with encoding. * include/ruby/encoding.h (rb_enc_asciicompat): check if ASCII compatible. * include/ruby/encoding.h (rb_enc_get_index): added prototype. * include/ruby/intern.h (rb_str_comparable, rb_str_equal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- insns.def | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'insns.def') diff --git a/insns.def b/insns.def index 1d9ef3d6f2..d31a9656bc 100644 --- a/insns.def +++ b/insns.def @@ -1700,13 +1700,14 @@ opt_eq if (str1 == str2) { val = Qtrue; } - else if (RSTRING_LEN(str1) == RSTRING_LEN(str2) && + else if (!ENCODING_GET(str1) && !ENCODING_GET(str2) && + RSTRING_LEN(str1) == RSTRING_LEN(str2) && rb_memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), RSTRING_LEN(str1)) == 0) { val = Qtrue; } else { - val = Qfalse; + val = rb_str_equal(str1, str2); } } else { -- cgit v1.2.3