summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-07-27 09:12:12 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-07-27 09:12:12 +0000
commit0abedcd80770841475006342c96d348d78f91ab8 (patch)
tree289c8c48ee23c65aeac5a2983433c47cdee08f41 /eval.c
parent980f8164797ce17f77be3e1ad9b5e4e96fdab4a3 (diff)
* 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
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c18
1 files changed, 15 insertions, 3 deletions
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. */