diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | parse.y | 8 | ||||
-rw-r--r-- | re.c | 6 | ||||
-rw-r--r-- | string.c | 2 |
4 files changed, 12 insertions, 8 deletions
@@ -1,3 +1,7 @@ +Mon Jan 28 11:17:28 2008 NARUSE, Yui <naruse@ruby-lang.org> + + * string.c, parse.y, re.c: use rb_ascii8bit_encoding. + Mon Jan 28 17:54:15 2008 NARUSE, Yui <naruse@ruby-lang.org> * enc/utf_7.h: add dummy encoding UTF-7 and its alias CP65000. @@ -271,7 +271,7 @@ struct parser_params { #define STR_NEW0() rb_enc_str_new(0,0,rb_usascii_encoding()) #define STR_NEW2(p) rb_enc_str_new((p),strlen(p),parser->enc) #define STR_NEW3(p,n,e,func) parser_str_new((p),(n),(e),(func),parser->enc) -#define STR_ENC(m) ((m)?parser->enc:rb_enc_from_index(0)) +#define STR_ENC(m) ((m)?parser->enc:rb_ascii8bit_encoding()) #define ENC_SINGLE(cr) ((cr)==ENC_CODERANGE_7BIT) #define TOK_INTERN(mb) rb_intern3(tok(), toklen(), STR_ENC(mb)) @@ -8842,7 +8842,7 @@ is_special_global_name(const char *m, const char *e, rb_encoding *enc) int rb_symname_p(const char *name) { - return rb_enc_symname_p(name, rb_enc_from_index(0)); + return rb_enc_symname_p(name, rb_ascii8bit_encoding()); } int @@ -8953,7 +8953,7 @@ rb_intern3(const char *name, long len, rb_encoding *enc) case '$': id |= ID_GLOBAL; if ((mb = is_special_global_name(++m, e, enc)) != 0) { - if (!--mb) enc = rb_enc_from_index(0); + if (!--mb) enc = rb_ascii8bit_encoding(); goto new_id; } break; @@ -9039,7 +9039,7 @@ rb_intern3(const char *name, long len, rb_encoding *enc) ID rb_intern2(const char *name, long len) { - return rb_intern3(name, len, rb_enc_from_index(0)); + return rb_intern3(name, len, rb_ascii8bit_encoding()); } #undef rb_intern @@ -2466,7 +2466,7 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self) if (argc == 3 && !NIL_P(argv[2])) { char *kcode = StringValuePtr(argv[2]); if (kcode[0] == 'n' || kcode[1] == 'N') { - enc = rb_enc_from_index(0); + enc = rb_ascii8bit_encoding(); flags |= ARG_ENCODING_FIXED; } else { @@ -2514,7 +2514,7 @@ rb_reg_quote(VALUE str) } if (ascii_only && rb_enc_get_index(str) != 0) { str = rb_str_new3(str); - rb_enc_associate(str, rb_enc_from_index(0)); + rb_enc_associate(str, rb_ascii8bit_encoding()); } return str; @@ -2746,7 +2746,7 @@ rb_reg_s_union(VALUE self, VALUE args0) result_enc = has_ascii_compat_fixed; } else { - result_enc = rb_enc_from_index(0); + result_enc = rb_ascii8bit_encoding(); } rb_enc_associate(source, result_enc); @@ -3477,7 +3477,7 @@ rb_str_dump(VALUE str) *q++ = '"'; if (!rb_enc_asciicompat(enc0)) { sprintf(q, ".force_encoding(\"%s\")", enc0->name); - enc0 = rb_enc_from_index(0); + enc0 = rb_ascii8bit_encoding(); } OBJ_INFECT(result, str); |