diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-25 16:40:02 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-25 16:40:02 +0000 |
commit | 42dcda08aef365e166b8784e0349a28896a871e6 (patch) | |
tree | d88f7c0ffd523d86a7ec11e2e846eb747bea485a /file.c | |
parent | f923cc360ae0e496da656a4253bc38fba12eed5d (diff) | |
download | ruby-42dcda08aef365e166b8784e0349a28896a871e6.tar.gz |
* string.c (rb_str_usascii_new{,2}: defined.
(rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty
string.
* encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined.
(rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i):
use rb_str_ascii_new.
* array.c (recursive_join, inspect_ary): ditto.
* object.c (nil_to_s, nil_inspect, true_to_s, false_to_s,
rb_mod_to_s): ditto.
* hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch,
env_clear, env_to_s, env_inspect): ditto.
* numeric.c (flo_to_s, int_chr, rb_fix2str): ditto.
* bignum.c (rb_big2str): ditto.
* file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname,
file_inspect_join, Init_file): ditto.
* test/ruby/test_ruby_m17n.rb: add checks for encoding of string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1632,7 +1632,7 @@ rb_file_ftype(const struct stat *st) t = "unknown"; } - return rb_str_new2(t); + return rb_usascii_str_new2(t); } /* @@ -2917,7 +2917,7 @@ rb_file_s_dirname(VALUE klass, VALUE fname) p = root; } if (p == name) - return rb_str_new2("."); + return rb_usascii_str_new2("."); #ifdef DOSISH_DRIVE_LETTER if (has_drive_letter(name) && isdirsep(*(name + 2))) { const char *top = skiproot(name + 2); @@ -2965,7 +2965,7 @@ rb_file_s_extname(VALUE klass, VALUE fname) e = strrchr(p, '.'); /* get the last dot of the last component */ if (!e || e == p || !e[1]) /* no dot, or the only dot is first or end? */ - return rb_str_new2(""); + return rb_str_new(0, 0); extname = rb_str_new(e, chompdirsep(e) - e); /* keep the dot, too! */ OBJ_INFECT(extname, fname); return extname; @@ -3014,7 +3014,7 @@ static VALUE file_inspect_join(VALUE ary, VALUE argp, int recur) { VALUE *arg = (VALUE *)argp; - if (recur) return rb_str_new2("[...]"); + if (recur) return rb_usascii_str_new2("[...]"); return rb_file_join(arg[0], arg[1]); } @@ -4516,14 +4516,14 @@ Init_File(void) rb_define_singleton_method(rb_cFile, "extname", rb_file_s_extname, 1); rb_define_singleton_method(rb_cFile, "path", rb_file_s_path, 1); - separator = rb_obj_freeze(rb_str_new2("/")); + separator = rb_obj_freeze(rb_usascii_str_new2("/")); rb_define_const(rb_cFile, "Separator", separator); rb_define_const(rb_cFile, "SEPARATOR", separator); rb_define_singleton_method(rb_cFile, "split", rb_file_s_split, 1); rb_define_singleton_method(rb_cFile, "join", rb_file_s_join, -2); #ifdef DOSISH - rb_define_const(rb_cFile, "ALT_SEPARATOR", rb_obj_freeze(rb_str_new2("\\"))); + rb_define_const(rb_cFile, "ALT_SEPARATOR", rb_obj_freeze(rb_usascii_str_new2("\\"))); #else rb_define_const(rb_cFile, "ALT_SEPARATOR", Qnil); #endif |