ruby-changes:15228
From: nobu <ko1@a...>
Date: Tue, 30 Mar 2010 18:11:43 +0900 (JST)
Subject: [ruby-changes:15228] Ruby:r27110 (ruby_1_8): * version.c (ruby_initial_load_paths): moved initial load path
nobu 2010-03-30 18:11:29 +0900 (Tue, 30 Mar 2010) New Revision: 27110 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27110 Log: * version.c (ruby_initial_load_paths): moved initial load path from ruby.c. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/ruby.c branches/ruby_1_8/version.c Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 27109) +++ ruby_1_8/ChangeLog (revision 27110) @@ -1,3 +1,8 @@ +Tue Mar 30 18:11:23 2010 Nobuyoshi Nakada <nobu@r...> + + * version.c (ruby_initial_load_paths): moved initial load path + from ruby.c. + Tue Mar 30 18:04:54 2010 Nobuyoshi Nakada <nobu@r...> * Makefile.in (config.status): ommit cached results. Index: ruby_1_8/version.c =================================================================== --- ruby_1_8/version.c (revision 27109) +++ ruby_1_8/version.c (revision 27110) @@ -40,6 +40,56 @@ sizeof("ruby - Copyright (C) - ") + 20 + sizeof(RUBY_AUTHOR)-1]; #endif +const struct ruby_initial_loadpath { +#ifdef RUBY_SEARCH_PATH + char search_path[sizeof(RUBY_SEARCH_PATH)]; +#endif + char site_lib2[sizeof(RUBY_SITE_LIB2)]; +#ifdef RUBY_SITE_THIN_ARCHLIB + char site_thin_archlib[sizeof(RUBY_SITE_THIN_ARCHLIB)]; +#endif + char site_archlib[sizeof(RUBY_SITE_ARCHLIB)]; + char site_lib[sizeof(RUBY_SITE_LIB)]; + + char vendor_lib2[sizeof(RUBY_VENDOR_LIB2)]; +#ifdef RUBY_VENDOR_THIN_ARCHLIB + char vendor_thin_archlib[sizeof(RUBY_VENDOR_THIN_ARCHLIB)]; +#endif + char vendor_archlib[sizeof(RUBY_VENDOR_ARCHLIB)]; + char vendor_lib[sizeof(RUBY_VENDOR_LIB)]; + + char lib[sizeof(RUBY_LIB)]; +#ifdef RUBY_THIN_ARCHLIB + char thin_archlib[sizeof(RUBY_THIN_ARCHLIB)]; +#endif + char archlib[sizeof(RUBY_ARCHLIB)]; + char terminator[1]; +} ruby_initial_load_paths = { +#ifdef RUBY_SEARCH_PATH + RUBY_SEARCH_PATH, +#endif + RUBY_SITE_LIB2, +#ifdef RUBY_SITE_THIN_ARCHLIB + RUBY_SITE_THIN_ARCHLIB, +#endif + RUBY_SITE_ARCHLIB, + RUBY_SITE_LIB, + + RUBY_VENDOR_LIB2, +#ifdef RUBY_VENDOR_THIN_ARCHLIB + RUBY_VENDOR_THIN_ARCHLIB, +#endif + RUBY_VENDOR_ARCHLIB, + RUBY_VENDOR_LIB, + + RUBY_LIB, +#ifdef RUBY_THIN_ARCHLIB + RUBY_THIN_ARCHLIB, +#endif + RUBY_ARCHLIB, + "" +}; + void Init_version() { Index: ruby_1_8/ruby.c =================================================================== --- ruby_1_8/ruby.c (revision 27109) +++ ruby_1_8/ruby.c (revision 27110) @@ -252,6 +252,8 @@ void ruby_init_loadpath() { + extern const struct ruby_initial_loadpath ruby_initial_load_paths; + const char *paths = (const char *)&ruby_initial_load_paths; #if defined LOAD_RELATIVE char libpath[FILENAME_MAX+1]; size_t baselen; @@ -310,38 +312,20 @@ #define RUBY_RELATIVE(path) (path) #define PREFIX_PATH() rubylib_mangled_path(exec_prefix, sizeof(exec_prefix)-1) #endif -#define incpush(path) rb_ary_push(rb_load_path, rubylib_mangled_path2(path)) +#define incpush(path, len) rb_ary_push(rb_load_path, rubylib_mangled_path(path, len)) if (rb_safe_level() == 0) { ruby_incpush(getenv("RUBYLIB")); } -#ifdef RUBY_SEARCH_PATH - incpush(RUBY_RELATIVE(RUBY_SEARCH_PATH)); -#endif + while (*paths) { + size_t len = strlen(paths); + incpush(RUBY_RELATIVE(paths), len); + paths += len + 1; + } - 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)); - if (rb_safe_level() == 0) { - incpush("."); + incpush(".", 1); } rb_const_set(rb_cObject, rb_intern("TMP_RUBY_PREFIX"), rb_obj_freeze(PREFIX_PATH())); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/