summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-03 05:29:19 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-03 05:29:19 +0000
commit4365377d76020c5cacf03a35989f370d05f5780a (patch)
tree3351683d7f4a8991b411dee9dad61f856c42b5e0 /eval.c
parent9f1e0829daa572708a0aeb3dddbd33d13cb15693 (diff)
* io.c (rb_io_popen): accept integer flags as mode.
* file.c (rb_find_file_ext): extension table can be supplied from outside. renamed. * eval.c (rb_f_require): replace rb_find_file_noext by rb_find_file_ext. * eval.c (rb_provided): should also check feature without extension. * numeric.c (flo_to_s): do not rely on decimal point to be '.' * parse.y (yylex): ternary ? can be followed by newline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/eval.c b/eval.c
index 1eacfca3f5..34998c332b 100644
--- a/eval.c
+++ b/eval.c
@@ -5311,6 +5311,14 @@ rb_feature_p(feature, wait)
return Qtrue;
}
+static const char *const loadable_ext[] = {
+ ".rb", DLEXT,
+#ifdef DLEXT2
+ DLEXT2,
+#endif
+ 0
+};
+
int
rb_provided(feature)
const char *feature;
@@ -5318,8 +5326,8 @@ rb_provided(feature)
VALUE f = rb_str_new2(feature);
if (strrchr(feature, '.') == 0) {
- if (rb_find_file_noext(&f) == 0) {
- return Qfalse;
+ if (rb_find_file_ext(&f, loadable_ext) == 0) {
+ return rb_feature_p(feature, Qfalse);
}
}
return rb_feature_p(RSTRING(f)->ptr, Qfalse);
@@ -5362,14 +5370,14 @@ rb_f_require(obj, fname)
}
else if (strcmp(".so", ext) == 0 || strcmp(".o", ext) == 0) {
fname = rb_str_new(RSTRING(fname)->ptr, ext-RSTRING(fname)->ptr);
- feature = tmp = rb_str_dup(fname);
- rb_str_cat2(tmp, DLEXT);
- tmp = rb_find_file(tmp);
- if (tmp) {
- fname = tmp;
+#ifdef DLEXT2
+ tmp = fname;
+ if (rb_find_file_ext(&tmp, loadable_ext+1)) {
+ feature = tmp;
+ fname = rb_find_file(tmp);
goto load_dyna;
}
-#ifdef DLEXT2
+#else
feature = tmp = rb_str_dup(fname);
rb_str_cat2(tmp, DLEXT);
tmp = rb_find_file(tmp);
@@ -5399,7 +5407,7 @@ rb_f_require(obj, fname)
#endif
}
tmp = fname;
- switch (rb_find_file_noext(&tmp)) {
+ switch (rb_find_file_ext(&tmp, loadable_ext)) {
case 0:
break;