From fa335a332386d2a57d32f8577035b18fd2a096a0 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 7 Jan 2008 07:48:24 +0000 Subject: * include/ruby/oniguruma.h (OnigEncodingType): new member ruby_encoding_index to avoid linear search in rb_enc_to_index. * include/ruby/encoding.h (rb_enc_to_index): macro defined to use ruby_encoding_index. * encoding.c (rb_enc_to_index): removed. (enc_register_at): initialize ruby_encoding_index member. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/encoding.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ruby/encoding.h') diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 3810d86b3..6536cb51a 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -67,7 +67,7 @@ typedef OnigEncodingType rb_encoding; int rb_enc_replicate(const char *, rb_encoding *); int rb_define_dummy_encoding(const char *); int rb_enc_dummy_p(rb_encoding *); -int rb_enc_to_index(rb_encoding*); +#define rb_enc_to_index(enc) ((enc) ? ((enc)->ruby_encoding_index) : 0) int rb_enc_get_index(VALUE obj); int rb_enc_find_index(const char *name); int rb_to_encoding_index(VALUE); -- cgit