summaryrefslogtreecommitdiff
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
commitf4e9d9a2c5c87314d5a7141e5ddbab6d3baa10d2 (patch)
tree3aa0b97df9894a567483751ede60c298b56045da /ruby.c
parent0d0fe1a5adbda4b9157118b8dbf64f28185f7b1e (diff)
* 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: svn+ssh://ci.ruby-lang.org/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 6ac062981b..99852afdbd 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(".");