diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-04 15:09:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-04 15:09:03 +0000 |
commit | c83d6db61bccd8a32f1ba523a47e60012c439bda (patch) | |
tree | edd70b428443dc39a9971ac5140a654239a16a34 /eval.c | |
parent | 4fd5436b328f1662f68614507943ae7eb8acd5a9 (diff) | |
download | ruby-c83d6db61bccd8a32f1ba523a47e60012c439bda.tar.gz |
* enumerator.c (Init_Enumerator): provided features should have
extensions.
* eval.c (rb_feature_p): returns type of the feature instead of
extension.
* eval.c (search_required): ruby library should be prior to statically
linked extentions. fixed: [ruby-dev:26711]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -6850,7 +6850,7 @@ static st_table *loading_tbl; #define IS_DLEXT(e) (strcmp(e, DLEXT) == 0) #endif -static char * +static int rb_feature_p(feature, ext, rb) const char *feature, *ext; int rb; @@ -6873,14 +6873,14 @@ rb_feature_p(feature, ext, rb) if (strncmp(f, feature, len) != 0) continue; if (!*(e = f + len)) { if (ext) continue; - return e; + return 'u'; } if (*e != '.') continue; if ((!rb || !ext) && (IS_SOEXT(e) || IS_DLEXT(e))) { - return e; + return 's'; } if ((rb || !ext) && (strcmp(e, ".rb") == 0)) { - return e; + return 'r'; } } return 0; @@ -6990,7 +6990,7 @@ search_required(fname, path) { VALUE tmp; char *ext, *ftptr; - int type; + int type, ft = 0; *path = 0; ext = strrchr(ftptr = RSTRING(fname)->ptr, '.'); @@ -7041,8 +7041,8 @@ search_required(fname, path) } } } - else if (ext = rb_feature_p(ftptr, 0, Qfalse)) { - return (*ext && (IS_SOEXT(ext) || IS_DLEXT(ext))) ? 's' : 'r'; + else if ((ft = rb_feature_p(ftptr, 0, Qfalse)) == 'r') { + return 'r'; } tmp = fname; type = rb_find_file_ext(&tmp, loadable_ext); @@ -7050,13 +7050,12 @@ search_required(fname, path) switch (type) { case 0: ftptr = RSTRING(tmp)->ptr; - if ((ext = rb_feature_p(ftptr, 0, Qfalse))) { - type = strcmp(".rb", ext); - break; - } - return 0; + if (ft) break; + return rb_feature_p(ftptr, 0, Qfalse); default: + if (ft) break; + case 1: ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.'); if (rb_feature_p(ftptr, ext, !--type)) break; *path = tmp; |