1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* include/ruby/encoding.h, encoding.c, re.c, io.c, parse.y, numeric.c,

ruby.c, transcode.c: rename rb_ascii_encoding. to
  rb_ascii8bit_encoding.  rb_ascii_encoding is ambiguous with 
  ASCII-8BIT and US-ASCII.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-12-22 23:47:18 +00:00
parent cd42707d86
commit 5b809a28f8
9 changed files with 21 additions and 14 deletions

View file

@ -1,3 +1,10 @@
Sun Dec 23 08:42:51 2007 Tanaka Akira <akr@fsij.org>
* include/ruby/encoding.h, encoding.c, re.c, io.c, parse.y, numeric.c,
ruby.c, transcode.c: rename rb_ascii_encoding. to
rb_ascii8bit_encoding. rb_ascii_encoding is ambiguous with
ASCII-8BIT and US-ASCII.
Sun Dec 23 03:35:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* version.h: use patchlevel if revision is not set.

View file

@ -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_ascii_encoding();
encoding = rb_ascii8bit_encoding();
enc_register_at(index, name, encoding);
enc = set_based_encoding(index, encoding);
FL_SET(enc, ENC_DUMMY);
@ -821,7 +821,7 @@ enc_load(VALUE klass, VALUE str)
}
rb_encoding *
rb_ascii_encoding(void)
rb_ascii8bit_encoding(void)
{
if (!enc_table) {
rb_enc_init();

View file

@ -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_ascii_encoding(void);
rb_encoding *rb_ascii8bit_encoding(void);
rb_encoding *rb_utf8_encoding(void);
rb_encoding *rb_default_external_encoding(void);
VALUE rb_enc_default_external(void);

4
io.c
View file

@ -350,7 +350,7 @@ rb_io_check_readable(rb_io_t *fptr)
if (!fptr->enc) {
fptr->enc = (fptr->fd == 0)
? rb_default_external_encoding()
: rb_ascii_encoding();
: rb_ascii8bit_encoding();
}
}
@ -2892,7 +2892,7 @@ rb_io_binmode(VALUE io)
#endif
fptr->mode |= FMODE_BINMODE;
fptr->enc = rb_ascii_encoding();
fptr->enc = rb_ascii8bit_encoding();
return io;
}

View file

@ -1860,7 +1860,7 @@ int_chr(int argc, VALUE *argv, VALUE num)
break;
}
enc = rb_to_encoding(argv[0]);
if (!enc) enc = rb_ascii_encoding();
if (!enc) enc = rb_ascii8bit_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);

View file

@ -4844,7 +4844,7 @@ parser_str_new(const char *p, long n, rb_encoding *enc, int func)
if (!(func & STR_FUNC_REGEXP) &&
rb_enc_asciicompat(enc) &&
rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) {
rb_enc_associate(str, rb_ascii_encoding());
rb_enc_associate(str, rb_ascii8bit_encoding());
}
return str;
@ -8968,7 +8968,7 @@ rb_intern3(const char *name, long len, rb_encoding *enc)
}
}
if (m - name < len) id = ID_JUNK;
if (enc != rb_ascii_encoding()) {
if (enc != rb_ascii8bit_encoding()) {
/*
* this clause makes sense only when called from other than
* rb_intern_str() taking care of code-range.
@ -8977,7 +8977,7 @@ rb_intern3(const char *name, long len, rb_encoding *enc)
for (; m <= name + len; ++m) {
if (!ISASCII(*m)) goto mbstr;
}
enc = rb_ascii_encoding();
enc = rb_ascii8bit_encoding();
}
mbstr:;
}

4
re.c
View file

@ -954,7 +954,7 @@ rb_reg_prepare_re(VALUE re, VALUE str)
need_recompile = 1;
}
if ((RBASIC(re)->flags & REG_ENCODING_NONE) &&
enc != rb_ascii_encoding() &&
enc != rb_ascii8bit_encoding() &&
rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT) {
rb_warn("regexp match /.../n against to %s string",
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 *a_enc = rb_ascii_encoding();
rb_encoding *a_enc = rb_ascii8bit_encoding();
if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify regexp");

4
ruby.c
View file

@ -144,12 +144,12 @@ locale_encoding(void)
int idx;
if (codeset == Qnil)
return rb_ascii_encoding();
return rb_ascii8bit_encoding();
name = StringValueCStr(codeset);
idx = rb_enc_find_index(name);
if (idx < 0)
return rb_ascii_encoding();
return rb_ascii8bit_encoding();
return rb_enc_from_index(idx);
}

View file

@ -357,7 +357,7 @@ str_transcode(int argc, VALUE *argv, VALUE *self)
}
/* set encoding */
if (!to_enc) {
to_encidx = rb_enc_replicate(to_e, rb_ascii_encoding());
to_encidx = rb_enc_replicate(to_e, rb_ascii8bit_encoding());
}
*self = dest;