diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | encoding.c | 24 | ||||
-rw-r--r-- | include/ruby/encoding.h | 8 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | ruby.c | 4 |
5 files changed, 23 insertions, 19 deletions
@@ -1,3 +1,7 @@ +Sat Dec 1 23:04:42 2007 Yukihiro Matsumoto <matz@ruby-lang.org> + + * encoding.c: rename primary_encoding -> default_external (encoding). + Sat Dec 1 19:52:57 2007 Tadayoshi Funaba <tadf@dotrb.org> * lib/date.rb (Time#to_datetime): use nsec instead of usec. diff --git a/encoding.c b/encoding.c index 403572070e..ec7405f961 100644 --- a/encoding.c +++ b/encoding.c @@ -586,10 +586,8 @@ enc_load(VALUE klass, VALUE str) return enc_find(klass, str); } -static int primary_encoding_index; - rb_encoding * -rb_enc_default(void) +rb_default_encoding(void) { if (!enc_table) { rb_enc_init(); @@ -597,28 +595,30 @@ rb_enc_default(void) return enc_table[0].enc; } +static int default_external_index; + rb_encoding * -rb_enc_primary(void) +rb_default_external_encoding(void) { - return rb_enc_from_index(primary_encoding_index); + return rb_enc_from_index(default_external_index); } VALUE -rb_get_primary_encoding(void) +rb_enc_default_external(void) { - return rb_enc_from_encoding(rb_enc_primary()); + return rb_enc_from_encoding(rb_default_external_encoding()); } static VALUE -get_primary_encoding(VALUE klass) +get_default_external(VALUE klass) { - return rb_get_primary_encoding(); + return rb_enc_default_external(); } void -rb_set_primary_encoding(VALUE encoding) +rb_enc_set_default_external(VALUE encoding) { - primary_encoding_index = rb_enc_to_index(rb_to_encoding(encoding)); + default_external_index = rb_enc_to_index(rb_to_encoding(encoding)); } static void @@ -689,7 +689,7 @@ Init_Encoding(void) rb_define_method(rb_cEncoding, "_dump", enc_dump, -1); rb_define_singleton_method(rb_cEncoding, "_load", enc_load, 1); - rb_define_singleton_method(rb_cEncoding, "primary_encoding", get_primary_encoding, 0); + rb_define_singleton_method(rb_cEncoding, "default_external", get_default_external, 0); /* should be imported from Oniguruma */ rb_enc_replicate("ISO-8859-1", rb_enc_find(rb_enc_name(ONIG_ENCODING_ASCII))); diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 0d6cd04fef..bdef191338 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -103,9 +103,9 @@ int rb_enc_str_coderange(VALUE); int rb_enc_str_asciionly_p(VALUE); #define rb_enc_str_asciicompat_p(str) rb_enc_asciicompat(rb_enc_get(str)) VALUE rb_enc_from_encoding(rb_encoding *enc); -rb_encoding *rb_enc_primary(void); -rb_encoding *rb_enc_default(void); -VALUE rb_get_primary_encoding(void); -void rb_set_primary_encoding(VALUE encoding); +rb_encoding *rb_default_encoding(void); +rb_encoding *rb_default_external_encoding(void); +VALUE rb_enc_default_external(void); +void rb_enc_set_default_external(VALUE encoding); #endif /* RUBY_ENCODING_H */ @@ -4847,7 +4847,7 @@ parser_str_new2(const char *p, long n, rb_encoding *enc, int has8bit,int hasmb) * instead. */ if ((coderange == ENC_CODERANGE_7BIT) && rb_enc_asciicompat(enc)) - enc = rb_enc_default(); + enc = rb_default_encoding(); return parser_str_new(p, n, enc, coderange); } @@ -163,7 +163,7 @@ locale_encoding(void) enc = rb_enc_from_index(idx); if (enc) return enc; } - return rb_enc_default(); + return rb_default_encoding(); } extern VALUE rb_load_path; @@ -1033,7 +1033,7 @@ process_options(VALUE arg) else { enc = locale_encoding(); } - rb_set_primary_encoding(rb_enc_from_encoding(enc)); + rb_enc_set_default_external(rb_enc_from_encoding(enc)); return (VALUE)tree; } |