summaryrefslogtreecommitdiffstats
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-05 02:21:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-05 02:21:37 +0000
commit0d1a6a4bd2716f8e3201a4307d5a886c61a29807 (patch)
tree3aa0b97df9894a567483751ede60c298b56045da /ruby.c
parent900ef642ddc541dd702d5130297cd68ec157d34c (diff)
downloadruby-0d1a6a4bd2716f8e3201a4307d5a886c61a29807.tar.gz
ruby-0d1a6a4bd2716f8e3201a4307d5a886c61a29807.tar.xz
ruby-0d1a6a4bd2716f8e3201a4307d5a886c61a29807.zip
* configure.in (RUBY_LIB_VERSION): added for library version, to
split from core version. [ruby-dev:37748] * configure.in (RUBY_LIB_PATH, etc): moved actual version dependent stuff to version.c. * ruby.c (ruby_init_loadpath_safe): ditto. * version.c (ruby_initial_load_paths): moved initial load path version depending on version from ruby.c. * version.h (RUBY_VERSION_{MAJOR,MINOR,TEENY}): now mean library and API version, and reverted to 1.9.1. [ruby-dev:37889] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/ruby.c b/ruby.c
index 6ac062981..99852afdb 100644
--- a/ruby.c
+++ b/ruby.c
@@ -359,6 +359,8 @@ void
ruby_init_loadpath_safe(int safe_level)
{
VALUE load_path;
+ extern const char ruby_initial_load_paths[];
+ const char *paths = ruby_initial_load_paths;
#if defined LOAD_RELATIVE
char libpath[MAXPATHLEN + 1];
char *p;
@@ -395,7 +397,7 @@ ruby_init_loadpath_safe(int safe_level)
rest = sizeof(libpath) - 1 - (p - libpath);
-#define RUBY_RELATIVE(path) (strncpy(p, (path), rest), libpath)
+#define RUBY_RELATIVE(path) (strlcpy(p, (path), rest), libpath)
#else
#define RUBY_RELATIVE(path) (path)
#endif
@@ -406,29 +408,10 @@ ruby_init_loadpath_safe(int safe_level)
ruby_push_include(getenv("RUBYLIB"), identical_path);
}
-#ifdef RUBY_SEARCH_PATH
- incpush(RUBY_RELATIVE(RUBY_SEARCH_PATH));
-#endif
-
- incpush(RUBY_RELATIVE(RUBY_SITE_LIB2));
-#ifdef RUBY_SITE_THIN_ARCHLIB
- incpush(RUBY_RELATIVE(RUBY_SITE_THIN_ARCHLIB));
-#endif
- incpush(RUBY_RELATIVE(RUBY_SITE_ARCHLIB));
- incpush(RUBY_RELATIVE(RUBY_SITE_LIB));
-
- incpush(RUBY_RELATIVE(RUBY_VENDOR_LIB2));
-#ifdef RUBY_VENDOR_THIN_ARCHLIB
- incpush(RUBY_RELATIVE(RUBY_VENDOR_THIN_ARCHLIB));
-#endif
- incpush(RUBY_RELATIVE(RUBY_VENDOR_ARCHLIB));
- incpush(RUBY_RELATIVE(RUBY_VENDOR_LIB));
-
- incpush(RUBY_RELATIVE(RUBY_LIB));
-#ifdef RUBY_THIN_ARCHLIB
- incpush(RUBY_RELATIVE(RUBY_THIN_ARCHLIB));
-#endif
- incpush(RUBY_RELATIVE(RUBY_ARCHLIB));
+ while (*paths) {
+ incpush(RUBY_RELATIVE(paths));
+ paths += strlen(paths) + 1;
+ }
if (safe_level == 0) {
incpush(".");