* eval.c (rb_provided): should check also path name to be loaded.
fixed: [ruby-dev:26093] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d8cd7516c5
commit
7b81c9d7a3
@ -1,3 +1,8 @@
|
||||
Sat Apr 23 11:45:29 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_provided): should check also path name to be loaded.
|
||||
fixed: [ruby-dev:26093]
|
||||
|
||||
Fri Apr 22 16:55:35 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||
|
||||
* ext/tk/tcltklib.c (ip_set_exc_message): fixed memory leak.
|
||||
|
26
eval.c
26
eval.c
@ -6779,23 +6779,33 @@ static const char *const loadable_ext[] = {
|
||||
0
|
||||
};
|
||||
|
||||
static int search_required _((VALUE, VALUE *));
|
||||
|
||||
int
|
||||
rb_provided(feature)
|
||||
const char *feature;
|
||||
{
|
||||
int i;
|
||||
char *buf;
|
||||
VALUE fname;
|
||||
|
||||
if (rb_feature_p(feature, 0, Qfalse))
|
||||
return Qtrue;
|
||||
if (!loading_tbl) return Qfalse;
|
||||
if (st_lookup(loading_tbl, (st_data_t)feature, 0)) return Qtrue;
|
||||
buf = ALLOCA_N(char, strlen(feature)+8);
|
||||
strcpy(buf, feature);
|
||||
for (i=0; ; i++) {
|
||||
if (!loadable_ext[i]) break;
|
||||
strcpy(buf+strlen(feature), loadable_ext[i]);
|
||||
if (st_lookup(loading_tbl, (st_data_t)buf, 0)) return Qtrue;
|
||||
if (loading_tbl) {
|
||||
if (st_lookup(loading_tbl, (st_data_t)feature, 0)) return Qtrue;
|
||||
buf = ALLOCA_N(char, strlen(feature)+8);
|
||||
strcpy(buf, feature);
|
||||
for (i=0; loadable_ext[i]; i++) {
|
||||
strcpy(buf+strlen(feature), loadable_ext[i]);
|
||||
if (st_lookup(loading_tbl, (st_data_t)buf, 0)) return Qtrue;
|
||||
}
|
||||
}
|
||||
if (search_required(rb_str_new2(feature), &fname)) {
|
||||
feature = RSTRING(fname)->ptr;
|
||||
if (rb_feature_p(feature, 0, Qfalse))
|
||||
return Qtrue;
|
||||
if (loading_tbl && st_lookup(loading_tbl, (st_data_t)feature, 0))
|
||||
return Qtrue;
|
||||
}
|
||||
return Qfalse;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user