diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-29 06:54:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-29 06:54:22 +0000 |
commit | 592dcccdf9144a70d1dc9452034c5a583ea8be4a (patch) | |
tree | 51c0adaf1aac5e393f5e5f02ed2dda6908696f96 /ruby.c | |
parent | 9a8b38cacfa029aa9bbc5f1600b1ead3903a8c88 (diff) | |
download | ruby-592dcccdf9144a70d1dc9452034c5a583ea8be4a.tar.gz |
ruby.c: no VARIABLE_LIBPATH
* ruby.c (ruby_init_loadpath_safe): removed code using fixed size
path buffer. relative load path is supported only on platforms
where dladdr is available, or on Windows, so !VARIABLE_LIBPATH
code is not used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 28 |
1 files changed, 2 insertions, 26 deletions
@@ -485,17 +485,8 @@ ruby_init_loadpath_safe(int safe_level) ID id_initial_load_path_mark; const char *paths = ruby_initial_load_paths; #if defined LOAD_RELATIVE -# if defined HAVE_DLADDR || defined __CYGWIN__ || defined _WIN32 -# define VARIABLE_LIBPATH 1 -# else -# define VARIABLE_LIBPATH 0 -# endif -# if VARIABLE_LIBPATH char *libpath; VALUE sopath; -# else - char libpath[MAXPATHLEN + 1]; -# endif size_t baselen; char *p; @@ -527,11 +518,10 @@ ruby_init_loadpath_safe(int safe_level) #elif defined(HAVE_DLADDR) sopath = dladdr_path((void *)(VALUE)expand_include_path); libpath = RSTRING_PTR(sopath); +#else +# error relative load path is not supported on this platform. #endif -#if !VARIABLE_LIBPATH - libpath[sizeof(libpath) - 1] = '\0'; -#endif #if defined DOSISH && !defined _WIN32 translit_char(libpath, '\\', '/'); #elif defined __CYGWIN__ @@ -582,26 +572,12 @@ ruby_init_loadpath_safe(int safe_level) p = p2; } #endif -#if !VARIABLE_LIBPATH - *p = 0; -#endif - } -#if !VARIABLE_LIBPATH - else { - strlcpy(libpath, ".", sizeof(libpath)); - p = libpath + 1; } baselen = p - libpath; -#define PREFIX_PATH() rb_str_new(libpath, baselen) -#else - baselen = p - libpath; rb_str_resize(sopath, baselen); libpath = RSTRING_PTR(sopath); #define PREFIX_PATH() sopath -#endif - #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 const size_t exec_prefix_len = strlen(ruby_exec_prefix); |