aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-03 05:37:42 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-03 05:37:42 +0000
commit0f35b58a2fbae58a20979de77a3a642c42f41899 (patch)
treecab4099dba0fde8650c94226a1f9ce94549561c9 /eval.c
parentc9d1be6327640aa5bc01f8c6c8846e4e3fb31337 (diff)
downloadruby-0f35b58a2fbae58a20979de77a3a642c42f41899.tar.gz
* ruby.c (proc_options): should not alter origargv[].
* ruby.c (set_arg0): long strings for $0 dumped core. * ruby.c (set_arg0): use setprogtitle() if it's available. * 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 '.' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1722 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 0ca486c207..aa97595cf1 100644
--- a/eval.c
+++ b/eval.c
@@ -5393,6 +5393,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;
@@ -5400,8 +5408,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);
@@ -5444,14 +5452,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);
@@ -5481,7 +5489,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;