* eval.c (rb_f_require): do not search adding .rb/.so suffixes if

the suffix specifiched.  [ruby-dev:18702]
  http://moonrock.jp/~don/d/200211.html#d08_t1


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-01-14 12:56:34 +00:00
parent 6e1f15fc8b
commit 17bb511df2
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,9 @@
Tue Jan 14 21:47:56 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* eval.c (rb_f_require): do not search adding .rb/.so suffixes if
the suffix specifiched. [ruby-dev:18702]
http://moonrock.jp/~don/d/200211.html#d08_t1
Tue Jan 14 01:21:32 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net> Tue Jan 14 01:21:32 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* io.c (next_argv): not always set binmode. * io.c (next_argv): not always set binmode.

10
eval.c
View File

@ -5621,18 +5621,18 @@ rb_f_require(obj, fname)
fname = tmp; fname = tmp;
goto load_rb; goto load_rb;
} }
goto not_found;
} }
else if (strcmp(".so", ext) == 0 || strcmp(".o", ext) == 0) { else if (strcmp(".so", ext) == 0 || strcmp(".o", ext) == 0) {
fname = rb_str_new(RSTRING(fname)->ptr, ext-RSTRING(fname)->ptr); tmp = rb_str_new(RSTRING(fname)->ptr, ext-RSTRING(fname)->ptr);
#ifdef DLEXT2 #ifdef DLEXT2
tmp = fname;
if (rb_find_file_ext(&tmp, loadable_ext+1)) { if (rb_find_file_ext(&tmp, loadable_ext+1)) {
feature = tmp; feature = tmp;
fname = rb_find_file(tmp); fname = rb_find_file(tmp);
goto load_dyna; goto load_dyna;
} }
#else #else
feature = tmp = rb_str_dup(fname); feature = tmp;
rb_str_cat2(tmp, DLEXT); rb_str_cat2(tmp, DLEXT);
tmp = rb_find_file(tmp); tmp = rb_find_file(tmp);
if (tmp) { if (tmp) {
@ -5640,6 +5640,7 @@ rb_f_require(obj, fname)
goto load_dyna; goto load_dyna;
} }
#endif #endif
goto not_found;
} }
else if (strcmp(DLEXT, ext) == 0) { else if (strcmp(DLEXT, ext) == 0) {
tmp = rb_find_file(fname); tmp = rb_find_file(fname);
@ -5648,6 +5649,7 @@ rb_f_require(obj, fname)
fname = tmp; fname = tmp;
goto load_dyna; goto load_dyna;
} }
goto not_found;
} }
#ifdef DLEXT2 #ifdef DLEXT2
else if (strcmp(DLEXT2, ext) == 0) { else if (strcmp(DLEXT2, ext) == 0) {
@ -5657,6 +5659,7 @@ rb_f_require(obj, fname)
fname = tmp; fname = tmp;
goto load_dyna; goto load_dyna;
} }
goto not_found;
} }
#endif #endif
} }
@ -5676,6 +5679,7 @@ rb_f_require(obj, fname)
} }
if (rb_feature_p(RSTRING(fname)->ptr, Qfalse)) if (rb_feature_p(RSTRING(fname)->ptr, Qfalse))
return Qfalse; return Qfalse;
not_found:
rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr); rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
load_dyna: load_dyna: