From 17bb511df2d33f4c344d7aefc2f5dfcd53fdaaf7 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 14 Jan 2003 12:56:34 +0000 Subject: [PATCH] * 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 --- ChangeLog | 6 ++++++ eval.c | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9368d9b0e7..3121d66aa3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Jan 14 21:47:56 2003 Nobuyoshi Nakada + + * 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 * io.c (next_argv): not always set binmode. diff --git a/eval.c b/eval.c index 5522cb4d65..5b0dfb5f14 100644 --- a/eval.c +++ b/eval.c @@ -5621,18 +5621,18 @@ rb_f_require(obj, fname) fname = tmp; goto load_rb; } + goto not_found; } 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 - tmp = fname; if (rb_find_file_ext(&tmp, loadable_ext+1)) { feature = tmp; fname = rb_find_file(tmp); goto load_dyna; } #else - feature = tmp = rb_str_dup(fname); + feature = tmp; rb_str_cat2(tmp, DLEXT); tmp = rb_find_file(tmp); if (tmp) { @@ -5640,6 +5640,7 @@ rb_f_require(obj, fname) goto load_dyna; } #endif + goto not_found; } else if (strcmp(DLEXT, ext) == 0) { tmp = rb_find_file(fname); @@ -5648,6 +5649,7 @@ rb_f_require(obj, fname) fname = tmp; goto load_dyna; } + goto not_found; } #ifdef DLEXT2 else if (strcmp(DLEXT2, ext) == 0) { @@ -5657,6 +5659,7 @@ rb_f_require(obj, fname) fname = tmp; goto load_dyna; } + goto not_found; } #endif } @@ -5676,6 +5679,7 @@ rb_f_require(obj, fname) } if (rb_feature_p(RSTRING(fname)->ptr, Qfalse)) return Qfalse; + not_found: rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr); load_dyna: