From 0abedcd80770841475006342c96d348d78f91ab8 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 27 Jul 2001 09:12:12 +0000 Subject: * eval.c (rb_provided): extension should be guessed using rb_find_file_noext(). * eval.c (rb_f_require): should call rb_feature_p() after extension completion. * eval.c (rb_eval): add CHECK_INTS before next, redo, retry to avoid potential uninterruptable infinite loop. * file.c (rb_file_s_expand_path): use CharNext() to expand. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 1e0339b8c2..83ad8b40a4 100644 --- a/eval.c +++ b/eval.c @@ -2398,6 +2398,7 @@ rb_eval(self, n) break; case NODE_NEXT: + CHECK_INTS; if (node->nd_stts) { return_value(avalue_to_svalue(rb_eval(self, node->nd_stts))); } @@ -2408,10 +2409,12 @@ rb_eval(self, n) break; case NODE_REDO: + CHECK_INTS; JUMP_TAG(TAG_REDO); break; case NODE_RETRY: + CHECK_INTS; JUMP_TAG(TAG_RETRY); break; @@ -5385,7 +5388,14 @@ int rb_provided(feature) const char *feature; { - return rb_feature_p(feature, Qfalse); + VALUE f = rb_str_new2(feature); + + if (strrchr(feature, '.') == 0) { + if (rb_find_file_noext(&f) == 0) { + return Qfalse; + } + } + return rb_feature_p(RSTRING(f)->ptr, Qfalse); } static void @@ -5413,8 +5423,6 @@ rb_f_require(obj, fname) volatile int safe = ruby_safe_level; SafeStringValue(fname); - if (rb_feature_p(RSTRING(fname)->ptr, Qtrue)) - return Qfalse; ext = strrchr(RSTRING(fname)->ptr, '.'); if (ext) { if (strcmp(".rb", ext) == 0) { @@ -5480,6 +5488,8 @@ rb_f_require(obj, fname) rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr); load_dyna: + if (rb_feature_p(RSTRING(feature)->ptr, Qfalse)) + return Qfalse; rb_provide_feature(feature); { int volatile old_vmode = scope_vmode; @@ -5500,6 +5510,8 @@ rb_f_require(obj, fname) return Qtrue; load_rb: + if (rb_feature_p(RSTRING(feature)->ptr, Qtrue)) + return Qfalse; ruby_safe_level = 0; rb_provide_feature(feature); /* loading ruby library should be serialized. */ -- cgit v1.2.3