diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-25 08:48:14 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-25 08:48:14 +0000 |
commit | 36163224f417b5641998207f54049136eab3e50b (patch) | |
tree | c987501a0313b7bd7e22a795ddc043fd3aa8a317 /eval.c | |
parent | dba9fc9dc7a1d1f02b26789a2017ce4dd20bb128 (diff) |
* string.c (rb_str_update): call rb_str_modify().
* eval.c (search_required): search actual file name once when no
extension specified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -6084,6 +6084,7 @@ search_required(fname, featurep, path) { VALUE tmp; char *ext, *ftptr; + int type; *featurep = fname; *path = 0; @@ -6116,24 +6117,22 @@ search_required(fname, featurep, path) if (*path = rb_find_file(fname)) return 's'; } } - if ((ext = rb_feature_p(ftptr, 0, Qfalse)) != 0) { - return strcmp(ext, ".rb") == 0 ? 'r' : 's'; - } tmp = fname; - switch (rb_find_file_ext(&tmp, loadable_ext)) { + switch (type = rb_find_file_ext(&tmp, loadable_ext)) { case 0: + if ((ext = rb_feature_p(ftptr, 0, Qfalse))) { + type = strcmp(".rb", ext); + break; + } return 0; - case 1: - *featurep = tmp; - *path = rb_find_file(tmp); - return 'r'; - default: *featurep = tmp; + ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.'); + if (rb_feature_p(ftptr, ext, !--type)) break; *path = rb_find_file(tmp); - return 's'; } + return type ? 's' : 'r'; } static void |