From 2254fc650b681c2582f25aa0d2be2cc8aba3cb8e Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 17 Apr 2014 08:24:15 +0000 Subject: [PATCH] ruby.c: drop older cygwin * ruby.c (push_include_cygwin): drop older cygwin support. * ruby.c (ruby_init_loadpath_safe): ditto, and always use String as libpath buffer on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/ruby.c b/ruby.c index 8cf3cfc3ff..752752f4b7 100644 --- a/ruby.c +++ b/ruby.c @@ -257,8 +257,7 @@ push_include_cygwin(const char *path, VALUE (*filter)(VALUE)) #define CONV_TO_POSIX_PATH(p, lib) \ cygwin_conv_path(CCP_WIN_A_TO_POSIX|CCP_RELATIVE, (p), (lib), sizeof(lib)) #else -#define CONV_TO_POSIX_PATH(p, lib) \ - cygwin_conv_to_posix_path((p), (lib)) +# error no cygwin_conv_path #endif if (CONV_TO_POSIX_PATH(p, rubylib) == 0) p = rubylib; @@ -348,7 +347,7 @@ ruby_init_loadpath_safe(int safe_level) extern const char ruby_initial_load_paths[]; const char *paths = ruby_initial_load_paths; #if defined LOAD_RELATIVE -# if defined HAVE_DLADDR || defined HAVE_CYGWIN_CONV_PATH +# if defined HAVE_DLADDR || defined __CYGWIN__ || defined _WIN32 # define VARIABLE_LIBPATH 1 # else # define VARIABLE_LIBPATH 0 @@ -363,13 +362,9 @@ ruby_init_loadpath_safe(int safe_level) char *p; #if defined _WIN32 || defined __CYGWIN__ -# if VARIABLE_LIBPATH sopath = rb_str_new(0, MAXPATHLEN); libpath = RSTRING_PTR(sopath); GetModuleFileName(libruby, libpath, MAXPATHLEN); -# else - GetModuleFileName(libruby, libpath, sizeof libpath); -# endif #elif defined(__EMX__) _execname(libpath, sizeof(libpath) - 1); #elif defined(HAVE_DLADDR) @@ -394,7 +389,6 @@ ruby_init_loadpath_safe(int safe_level) translit_char(libpath, '\\', '/'); #elif defined __CYGWIN__ { -# if VARIABLE_LIBPATH const int win_to_posix = CCP_WIN_A_TO_POSIX | CCP_RELATIVE; size_t newsize = cygwin_conv_path(win_to_posix, libpath, 0, 0); if (newsize > 0) { @@ -406,11 +400,6 @@ ruby_init_loadpath_safe(int safe_level) libpath = p; } } -# else - char rubylib[FILENAME_MAX]; - cygwin_conv_to_posix_path(libpath, rubylib); - strncpy(libpath, rubylib, sizeof(libpath)); -# endif } #endif p = strrchr(libpath, '/');