mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 20214:
* eval.c (rb_feature_p): returns found feature name if loading. [ruby-core:19798] * eval.c (search_required): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@22201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
06df50e382
commit
d896aedf3d
3 changed files with 41 additions and 18 deletions
|
|
@ -1,3 +1,10 @@
|
|||
Tue Feb 10 19:40:58 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_feature_p): returns found feature name if loading.
|
||||
[ruby-core:19798]
|
||||
|
||||
* eval.c (search_required): ditto.
|
||||
|
||||
Mon Feb 9 17:35:38 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (rb_w32_accept): secure fd before accept because if
|
||||
|
|
|
|||
44
eval.c
44
eval.c
|
|
@ -7123,16 +7123,16 @@ static const char *const loadable_ext[] = {
|
|||
0
|
||||
};
|
||||
|
||||
static int rb_feature_p _((const char *, const char *, int));
|
||||
static int rb_feature_p _((const char **, const char *, int));
|
||||
static int search_required _((VALUE, VALUE *, VALUE *));
|
||||
|
||||
static int
|
||||
rb_feature_p(feature, ext, rb)
|
||||
const char *feature, *ext;
|
||||
rb_feature_p(ftptr, ext, rb)
|
||||
const char **ftptr, *ext;
|
||||
int rb;
|
||||
{
|
||||
VALUE v;
|
||||
const char *f, *e;
|
||||
const char *f, *e, *feature = *ftptr;
|
||||
long i, len, elen;
|
||||
|
||||
if (ext) {
|
||||
|
|
@ -7150,18 +7150,21 @@ rb_feature_p(feature, ext, rb)
|
|||
continue;
|
||||
if (!*(e = f + len)) {
|
||||
if (ext) continue;
|
||||
*ftptr = 0;
|
||||
return 'u';
|
||||
}
|
||||
if (*e != '.') continue;
|
||||
if ((!rb || !ext) && (IS_SOEXT(e) || IS_DLEXT(e))) {
|
||||
*ftptr = 0;
|
||||
return 's';
|
||||
}
|
||||
if ((rb || !ext) && (strcmp(e, ".rb") == 0)) {
|
||||
*ftptr = 0;
|
||||
return 'r';
|
||||
}
|
||||
}
|
||||
if (loading_tbl) {
|
||||
if (st_lookup(loading_tbl, (st_data_t)feature, 0)) {
|
||||
if (st_lookup(loading_tbl, (st_data_t)feature, (st_data_t *)ftptr)) {
|
||||
if (!ext) return 'u';
|
||||
return strcmp(ext, ".rb") ? 's' : 'r';
|
||||
}
|
||||
|
|
@ -7173,7 +7176,7 @@ rb_feature_p(feature, ext, rb)
|
|||
MEMCPY(buf, feature, char, len);
|
||||
for (i = 0; (e = loadable_ext[i]) != 0; i++) {
|
||||
strncpy(buf + len, e, DLEXT_MAXLEN + 1);
|
||||
if (st_lookup(loading_tbl, (st_data_t)buf, 0)) {
|
||||
if (st_lookup(loading_tbl, (st_data_t)buf, (st_data_t *)ftptr)) {
|
||||
return i ? 's' : 'r';
|
||||
}
|
||||
}
|
||||
|
|
@ -7181,6 +7184,7 @@ rb_feature_p(feature, ext, rb)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#define rb_feature_p(feature, ext, rb) rb_feature_p(&feature, ext, rb)
|
||||
|
||||
int
|
||||
rb_provided(feature)
|
||||
|
|
@ -7289,7 +7293,7 @@ search_required(fname, featurep, path)
|
|||
VALUE fname, *featurep, *path;
|
||||
{
|
||||
VALUE tmp;
|
||||
char *ext, *ftptr;
|
||||
const char *ext, *ftptr;
|
||||
int type;
|
||||
|
||||
*featurep = fname;
|
||||
|
|
@ -7297,12 +7301,18 @@ search_required(fname, featurep, path)
|
|||
ext = strrchr(ftptr = RSTRING_PTR(fname), '.');
|
||||
if (ext && !strchr(ext, '/')) {
|
||||
if (strcmp(".rb", ext) == 0) {
|
||||
if (rb_feature_p(ftptr, ext, Qtrue)) return 'r';
|
||||
if (rb_feature_p(ftptr, ext, Qtrue)) {
|
||||
if (ftptr) *path = rb_str_new2(ftptr);
|
||||
return 'r';
|
||||
}
|
||||
if ((*path = rb_find_file(fname)) != 0) return 'r';
|
||||
return 0;
|
||||
}
|
||||
else if (IS_SOEXT(ext)) {
|
||||
if (rb_feature_p(ftptr, ext, Qfalse)) return 's';
|
||||
if (rb_feature_p(ftptr, ext, Qfalse)) {
|
||||
if (ftptr) *path = rb_str_new2(ftptr);
|
||||
return 's';
|
||||
}
|
||||
tmp = rb_str_new(RSTRING_PTR(fname), ext-RSTRING_PTR(fname));
|
||||
*featurep = tmp;
|
||||
#ifdef DLEXT2
|
||||
|
|
@ -7321,7 +7331,10 @@ search_required(fname, featurep, path)
|
|||
#endif
|
||||
}
|
||||
else if (IS_DLEXT(ext)) {
|
||||
if (rb_feature_p(ftptr, ext, Qfalse)) return 's';
|
||||
if (rb_feature_p(ftptr, ext, Qfalse)) {
|
||||
if (ftptr) *path = rb_str_new2(ftptr);
|
||||
return 's';
|
||||
}
|
||||
if ((*path = rb_find_file(fname)) != 0) return 's';
|
||||
}
|
||||
}
|
||||
|
|
@ -7330,13 +7343,16 @@ search_required(fname, featurep, path)
|
|||
*featurep = tmp;
|
||||
switch (type) {
|
||||
case 0:
|
||||
ftptr = RSTRING_PTR(tmp);
|
||||
return rb_feature_p(ftptr, 0, Qfalse);
|
||||
type = rb_feature_p(ftptr, 0, Qfalse);
|
||||
if (type && ftptr) *path = rb_str_new2(ftptr);
|
||||
return type;
|
||||
|
||||
default:
|
||||
ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.');
|
||||
if (rb_feature_p(ftptr, ext, !--type)) break;
|
||||
*path = rb_find_file(tmp);
|
||||
if (!rb_feature_p(ftptr, ext, !--type))
|
||||
*path = rb_find_file(tmp);
|
||||
else if (ftptr)
|
||||
*path = rb_str_new2(ftptr);
|
||||
}
|
||||
return type ? 's' : 'r';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
#define RUBY_VERSION "1.8.7"
|
||||
#define RUBY_RELEASE_DATE "2009-02-09"
|
||||
#define RUBY_RELEASE_DATE "2009-02-10"
|
||||
#define RUBY_VERSION_CODE 187
|
||||
#define RUBY_RELEASE_CODE 20090209
|
||||
#define RUBY_PATCHLEVEL 111
|
||||
#define RUBY_RELEASE_CODE 20090210
|
||||
#define RUBY_PATCHLEVEL 112
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 8
|
||||
#define RUBY_VERSION_TEENY 7
|
||||
#define RUBY_RELEASE_YEAR 2009
|
||||
#define RUBY_RELEASE_MONTH 2
|
||||
#define RUBY_RELEASE_DAY 9
|
||||
#define RUBY_RELEASE_DAY 10
|
||||
|
||||
#ifdef RUBY_EXTERN
|
||||
RUBY_EXTERN const char ruby_version[];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue