ruby-changes:13607
From: nobu <ko1@a...>
Date: Sun, 18 Oct 2009 18:32:21 +0900 (JST)
Subject: [ruby-changes:13607] Ruby:r25390 (trunk): * ruby.c (ruby_init_loadpath_safe): should not dup tmp string. a
nobu 2009-10-18 18:32:02 +0900 (Sun, 18 Oct 2009) New Revision: 25390 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25390 Log: * ruby.c (ruby_init_loadpath_safe): should not dup tmp string. a patch from neomjp neomjp in [ruby-core:24251]. Modified files: trunk/ChangeLog trunk/ruby.c Index: ChangeLog =================================================================== --- ChangeLog (revision 25389) +++ ChangeLog (revision 25390) @@ -1,3 +1,8 @@ +Sun Oct 18 18:31:58 2009 Nobuyoshi Nakada <nobu@r...> + + * ruby.c (ruby_init_loadpath_safe): should not dup tmp string. a + patch from neomjp neomjp in [ruby-core:24251]. + Sun Oct 18 09:49:14 2009 Yuki Sonoda (Yugui) <yugui@y...> * test/test_prime.rb Index: ruby.c =================================================================== --- ruby.c (revision 25389) +++ ruby.c (revision 25390) @@ -350,8 +350,8 @@ VALUE sopath; # else char libpath[MAXPATHLEN + 1]; - size_t baselen; # endif + size_t baselen; char *p; #if defined _WIN32 || defined __CYGWIN__ @@ -416,16 +416,13 @@ strlcpy(libpath, ".", sizeof(libpath)); p = libpath + 1; } - - baselen = p - libpath; - -#define BASEPATH() rb_str_buf_cat(rb_str_buf_new(baselen+len), libpath, baselen) #else rb_str_set_len(sopath, p - libpath); - -#define BASEPATH() rb_str_dup(sopath) #endif + baselen = p - libpath; +#define BASEPATH() rb_str_buf_cat(rb_str_buf_new(baselen+len), libpath, baselen) + #define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), path, len) #else #define RUBY_RELATIVE(path, len) rubylib_mangled_path(path, len) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/