diff --git a/ChangeLog b/ChangeLog index 4ccc57d296..3051dce859 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Dec 22 03:54:18 2007 Yukihiro Matsumoto + + * encoding.c (rb_ascii_encoding): renamed from previous + rb_default_encoding(). + Sat Dec 22 02:49:02 2007 Yukihiro Matsumoto * parse.y (command): block from cmd_brace_block was ignored. diff --git a/encoding.c b/encoding.c index 5e60f95ad4..2f77f02d08 100644 --- a/encoding.c +++ b/encoding.c @@ -236,7 +236,7 @@ rb_define_dummy_encoding(const char *name) enc_check_duplication(name); if (index < ENCODING_INLINE_MAX) index = ENCODING_INLINE_MAX; if (enc_table_expand(index + 1) < 0) return -1; - encoding = rb_default_encoding(); + encoding = rb_ascii_encoding(); enc_register_at(index, name, encoding); enc = set_based_encoding(index, encoding); FL_SET(enc, ENC_DUMMY); @@ -742,7 +742,7 @@ enc_load(VALUE klass, VALUE str) } rb_encoding * -rb_default_encoding(void) +rb_ascii_encoding(void) { if (!enc_table) { rb_enc_init(); diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 46ecf2c173..db19ee9d70 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -115,7 +115,7 @@ 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_default_encoding(void); +rb_encoding *rb_ascii_encoding(void); rb_encoding *rb_utf8_encoding(void); rb_encoding *rb_default_external_encoding(void); VALUE rb_enc_default_external(void); diff --git a/io.c b/io.c index 06a0c3aa23..567e7b5d5d 100644 --- a/io.c +++ b/io.c @@ -2862,7 +2862,7 @@ rb_io_binmode(VALUE io) #endif fptr->mode |= FMODE_BINMODE; - fptr->enc = rb_default_encoding(); + fptr->enc = rb_ascii_encoding(); return io; } diff --git a/numeric.c b/numeric.c index 45a9ce025e..a152c340d9 100644 --- a/numeric.c +++ b/numeric.c @@ -1860,7 +1860,7 @@ int_chr(int argc, VALUE *argv, VALUE num) break; } enc = rb_to_encoding(argv[0]); - if (!enc) enc = rb_default_encoding(); + if (!enc) enc = rb_ascii_encoding(); if (i < 0 || (n = rb_enc_codelen(i, enc)) <= 0) goto out_of_range; str = rb_enc_str_new(0, n, enc); rb_enc_mbcput(i, RSTRING_PTR(str), enc); diff --git a/re.c b/re.c index e23a1b7622..971d3e667b 100644 --- a/re.c +++ b/re.c @@ -954,7 +954,7 @@ rb_reg_prepare_re(VALUE re, VALUE str) need_recompile = 1; } if ((RBASIC(re)->flags & REG_ENCODING_NONE) && - enc != rb_default_encoding() && + enc != rb_ascii_encoding() && rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT) { rb_warn("none encoding regexp with non ASCII string (string encoding: %s)", rb_enc_name(enc)); @@ -1964,7 +1964,7 @@ rb_reg_initialize(VALUE obj, const char *s, int len, rb_encoding *enc, struct RRegexp *re = RREGEXP(obj); VALUE unescaped; rb_encoding *fixed_enc = 0; - rb_encoding *d_enc = rb_default_encoding(); + rb_encoding *a_enc = rb_ascii_encoding(); if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4) rb_raise(rb_eSecurityError, "Insecure: can't modify regexp"); @@ -1982,17 +1982,17 @@ rb_reg_initialize(VALUE obj, const char *s, int len, rb_encoding *enc, if (fixed_enc) { if ((fixed_enc != enc && (options & ARG_ENCODING_FIXED)) || - (fixed_enc != d_enc && (options & ARG_ENCODING_NONE))) { + (fixed_enc != a_enc && (options & ARG_ENCODING_NONE))) { strcpy(err, "incompatible character encoding"); return -1; } - if (fixed_enc != d_enc) { + if (fixed_enc != a_enc) { options |= ARG_ENCODING_FIXED; enc = fixed_enc; } } else if (!(options & ARG_ENCODING_FIXED)) { - enc = d_enc; + enc = a_enc; } rb_enc_associate((VALUE)re, enc); diff --git a/ruby.c b/ruby.c index 19b243578f..adb7269ad2 100644 --- a/ruby.c +++ b/ruby.c @@ -144,12 +144,12 @@ locale_encoding(void) int idx; if (codeset == Qnil) - return rb_default_encoding(); + return rb_ascii_encoding(); name = StringValueCStr(codeset); idx = rb_enc_find_index(name); if (idx < 0) - return rb_default_encoding(); + return rb_ascii_encoding(); return rb_enc_from_index(idx); } diff --git a/transcode.c b/transcode.c index cd3f56dc6b..002024e104 100644 --- a/transcode.c +++ b/transcode.c @@ -345,7 +345,7 @@ str_transcode(int argc, VALUE *argv, VALUE *self) } /* set encoding */ if (!to_enc) { - to_encidx = rb_enc_replicate(to_e, rb_default_encoding()); + to_encidx = rb_enc_replicate(to_e, rb_ascii_encoding()); } *self = dest;