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

* string.c (str_new): remove encoding assumption of empty string.

* hash.c ( rb_f_getenv, env_fetch, env_inspect): result of ENV should
  be always ASCII-8BIT.

* object.c (nil_to_s): nil.to_s should be US-ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-02-28 18:13:45 +00:00
parent 3cb57fb1c3
commit 50a860d006
5 changed files with 16 additions and 10 deletions

View file

@ -1,3 +1,12 @@
Fri Feb 29 02:50:07 2008 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (str_new): remove encoding assumption of empty string.
* hash.c ( rb_f_getenv, env_fetch, env_inspect): result of ENV should
be always ASCII-8BIT.
* object.c (nil_to_s): nil.to_s should be US-ASCII.
Fri Feb 29 02:24:22 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: forgot to update RELEASE_DATE

6
hash.c
View file

@ -1826,7 +1826,7 @@ rb_f_getenv(VALUE obj, VALUE name)
if (strcmp(nam, PATH_ENV) == 0 && !rb_env_path_tainted())
#endif
{
VALUE str = rb_usascii_str_new2(env);
VALUE str = rb_str_new2(env);
rb_obj_freeze(str);
return str;
@ -1867,7 +1867,7 @@ env_fetch(int argc, VALUE *argv)
#else
if (strcmp(nam, PATH_ENV) == 0 && !rb_env_path_tainted())
#endif
return rb_usascii_str_new2(env);
return rb_str_new2(env);
return env_str_new2(env);
}
@ -2244,7 +2244,7 @@ env_inspect(void)
rb_str_buf_cat2(str, "\"");
rb_str_buf_cat(str, *env, s-*env);
rb_str_buf_cat2(str, "\"=>");
i = rb_inspect(rb_usascii_str_new2(s+1));
i = rb_inspect(rb_str_new2(s+1));
rb_str_buf_append(str, i);
}
env++;

View file

@ -808,7 +808,7 @@ nil_to_f(VALUE obj)
static VALUE
nil_to_s(VALUE obj)
{
return rb_str_new(0, 0);
return rb_usascii_str_new(0, 0);
}
/*

View file

@ -365,9 +365,6 @@ str_new(VALUE klass, const char *ptr, long len)
if (ptr) {
memcpy(RSTRING_PTR(str), ptr, len);
}
if (len == 0) {
ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
}
STR_SET_LEN(str, len);
RSTRING_PTR(str)[len] = '\0';
return str;

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2008-02-28"
#define RUBY_RELEASE_DATE "2008-02-29"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20080228
#define RUBY_RELEASE_CODE 20080229
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 2
#define RUBY_RELEASE_DAY 28
#define RUBY_RELEASE_DAY 29
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];