* hash.c (rb_f_getenv): use rb_filesystem_str_new_cstr
instead of rb_str_new2. ENV['PATH'].encoding should be Filesystem Encoding because its content is related to filesystem. see [ruby-dev:39393] * hash.c (env_fetch): ditto. * string.c (rb_filesystem_str_new): defined. * string.c (rb_filesystem_str_new_cstr): ditto. * include/ruby/intern.h (rb_filesystem_str_new): added. * include/ruby/intern.h (rb_filesystem_str_new_cstr): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ff504d3cc9
commit
e0af046ad0
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
|||||||
|
Tue Sep 29 04:07:58 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* hash.c (rb_f_getenv): use rb_filesystem_str_new_cstr
|
||||||
|
instead of rb_str_new2.
|
||||||
|
ENV['PATH'].encoding should be Filesystem Encoding
|
||||||
|
because its content is related to filesystem.
|
||||||
|
see [ruby-dev:39393]
|
||||||
|
|
||||||
|
* hash.c (env_fetch): ditto.
|
||||||
|
|
||||||
|
* string.c (rb_filesystem_str_new): defined.
|
||||||
|
|
||||||
|
* string.c (rb_filesystem_str_new_cstr): ditto.
|
||||||
|
|
||||||
|
* include/ruby/intern.h (rb_filesystem_str_new): added.
|
||||||
|
|
||||||
|
* include/ruby/intern.h (rb_filesystem_str_new_cstr): ditto.
|
||||||
|
|
||||||
Tue Sep 29 04:06:18 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
Tue Sep 29 04:06:18 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* include/ruby/st.h: include inttypes.h and stdint.h.
|
* include/ruby/st.h: include inttypes.h and stdint.h.
|
||||||
|
4
hash.c
4
hash.c
@ -1931,7 +1931,7 @@ rb_f_getenv(VALUE obj, VALUE name)
|
|||||||
env = getenv(nam);
|
env = getenv(nam);
|
||||||
if (env) {
|
if (env) {
|
||||||
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env)) {
|
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env)) {
|
||||||
VALUE str = rb_str_new2(env);
|
VALUE str = rb_filesystem_str_new_cstr(env);
|
||||||
|
|
||||||
rb_obj_freeze(str);
|
rb_obj_freeze(str);
|
||||||
return str;
|
return str;
|
||||||
@ -1968,7 +1968,7 @@ env_fetch(int argc, VALUE *argv)
|
|||||||
return if_none;
|
return if_none;
|
||||||
}
|
}
|
||||||
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env))
|
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(env))
|
||||||
return rb_str_new2(env);
|
return rb_filesystem_str_new_cstr(env);
|
||||||
return env_str_new2(env);
|
return env_str_new2(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,6 +601,8 @@ VALUE rb_external_str_new(const char*, long);
|
|||||||
VALUE rb_external_str_new_cstr(const char*);
|
VALUE rb_external_str_new_cstr(const char*);
|
||||||
VALUE rb_locale_str_new(const char*, long);
|
VALUE rb_locale_str_new(const char*, long);
|
||||||
VALUE rb_locale_str_new_cstr(const char*);
|
VALUE rb_locale_str_new_cstr(const char*);
|
||||||
|
VALUE rb_filesystem_str_new(const char*, long);
|
||||||
|
VALUE rb_filesystem_str_new_cstr(const char*);
|
||||||
VALUE rb_str_buf_new(long);
|
VALUE rb_str_buf_new(long);
|
||||||
VALUE rb_str_buf_new_cstr(const char*);
|
VALUE rb_str_buf_new_cstr(const char*);
|
||||||
VALUE rb_str_buf_new2(const char*);
|
VALUE rb_str_buf_new2(const char*);
|
||||||
|
12
string.c
12
string.c
@ -574,6 +574,18 @@ rb_locale_str_new_cstr(const char *ptr)
|
|||||||
return rb_external_str_new_with_enc(ptr, strlen(ptr), rb_locale_encoding());
|
return rb_external_str_new_with_enc(ptr, strlen(ptr), rb_locale_encoding());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_filesystem_str_new(const char *ptr, long len)
|
||||||
|
{
|
||||||
|
return rb_external_str_new_with_enc(ptr, len, rb_filesystem_encoding());
|
||||||
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_filesystem_str_new_cstr(const char *ptr)
|
||||||
|
{
|
||||||
|
return rb_external_str_new_with_enc(ptr, strlen(ptr), rb_filesystem_encoding());
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_str_export(VALUE str)
|
rb_str_export(VALUE str)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user