mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_load): should check if tainted even when wrap is
specified. * regex.c (re_compile_pattern): too much optimization for the cases like /(.|a)b/. * variable.c (fc_i): removed vast string allocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
044f08e884
commit
286f303a4d
5 changed files with 74 additions and 57 deletions
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
||||||
|
Wed Jun 6 16:11:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_load): should check if tainted even when wrap is
|
||||||
|
specified.
|
||||||
|
|
||||||
|
Wed Jun 6 14:34:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* regex.c (re_compile_pattern): too much optimization for the
|
||||||
|
cases like /(.|a)b/.
|
||||||
|
|
||||||
|
Tue Jun 5 23:58:43 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* variable.c (fc_i): removed vast string allocation.
|
||||||
|
|
||||||
Tue Jun 5 15:16:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Jun 5 15:16:06 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_add_method): should not call rb_secure(), for
|
* eval.c (rb_add_method): should not call rb_secure(), for
|
||||||
|
|
|
||||||
5
eval.c
5
eval.c
|
|
@ -5128,12 +5128,7 @@ rb_load(fname, wrap)
|
||||||
NODE *saved_cref = ruby_cref;
|
NODE *saved_cref = ruby_cref;
|
||||||
TMP_PROTECT;
|
TMP_PROTECT;
|
||||||
|
|
||||||
if (wrap) {
|
|
||||||
Check_Type(fname, T_STRING);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Check_SafeStr(fname);
|
Check_SafeStr(fname);
|
||||||
}
|
|
||||||
file = rb_find_file(RSTRING(fname)->ptr);
|
file = rb_find_file(RSTRING(fname)->ptr);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
|
rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
|
||||||
|
|
|
||||||
16
regex.c
16
regex.c
|
|
@ -2360,21 +2360,7 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
|
|
||||||
laststart++;
|
laststart++;
|
||||||
EXTRACT_NUMBER_AND_INCR(mcnt, laststart);
|
EXTRACT_NUMBER_AND_INCR(mcnt, laststart);
|
||||||
if (mcnt == 4 && *laststart == anychar) {
|
if (*laststart == charset || *laststart == charset_not) {
|
||||||
switch ((enum regexpcode)laststart[1]) {
|
|
||||||
case jump_n:
|
|
||||||
case finalize_jump:
|
|
||||||
case maybe_finalize_jump:
|
|
||||||
case jump:
|
|
||||||
case jump_past_alt:
|
|
||||||
case dummy_failure_jump:
|
|
||||||
bufp->options |= RE_OPTIMIZE_ANCHOR;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (*laststart == charset || *laststart == charset_not) {
|
|
||||||
p0 = laststart;
|
p0 = laststart;
|
||||||
mcnt = *++p0;
|
mcnt = *++p0;
|
||||||
p0 += mcnt+1;
|
p0 += mcnt+1;
|
||||||
|
|
|
||||||
66
variable.c
66
variable.c
|
|
@ -36,6 +36,33 @@ struct fc_result {
|
||||||
struct fc_result *prev;
|
struct fc_result *prev;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
fc_path(fc, name)
|
||||||
|
struct fc_result *fc;
|
||||||
|
ID name;
|
||||||
|
{
|
||||||
|
VALUE path, tmp;
|
||||||
|
|
||||||
|
path = rb_str_new2(rb_id2name(name));
|
||||||
|
while (fc) {
|
||||||
|
if (fc->track == rb_cObject) break;
|
||||||
|
if (ROBJECT(fc->track)->iv_tbl &&
|
||||||
|
st_lookup(ROBJECT(fc->track)->iv_tbl, rb_intern("__classpath__"), &tmp)) {
|
||||||
|
tmp = rb_str_dup(tmp);
|
||||||
|
rb_str_cat2(tmp, "::");
|
||||||
|
rb_str_append(tmp, path);
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
tmp = rb_str_new2(rb_id2name(fc->name));
|
||||||
|
rb_str_cat2(tmp, "::");
|
||||||
|
rb_str_append(tmp, path);
|
||||||
|
path = tmp;
|
||||||
|
fc = fc->prev;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fc_i(key, value, res)
|
fc_i(key, value, res)
|
||||||
ID key;
|
ID key;
|
||||||
|
|
@ -43,49 +70,44 @@ fc_i(key, value, res)
|
||||||
struct fc_result *res;
|
struct fc_result *res;
|
||||||
{
|
{
|
||||||
VALUE path;
|
VALUE path;
|
||||||
char *name;
|
|
||||||
|
|
||||||
if (!rb_is_const_id(key)) return ST_CONTINUE;
|
if (!rb_is_const_id(key)) return ST_CONTINUE;
|
||||||
|
|
||||||
name = rb_id2name(key);
|
|
||||||
if (res->path) {
|
|
||||||
path = rb_str_dup(res->path);
|
|
||||||
rb_str_cat2(path, "::");
|
|
||||||
rb_str_cat2(path, name);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
path = rb_str_new2(name);
|
|
||||||
}
|
|
||||||
if (value == res->klass) {
|
if (value == res->klass) {
|
||||||
res->name = key;
|
res->path = fc_path(res, key);
|
||||||
res->path = path;
|
|
||||||
return ST_STOP;
|
return ST_STOP;
|
||||||
}
|
}
|
||||||
if (rb_obj_is_kind_of(value, rb_cModule)) {
|
switch (TYPE(value)) {
|
||||||
|
case T_MODULE:
|
||||||
|
case T_CLASS:
|
||||||
|
if (!RCLASS(value)->iv_tbl) return ST_CONTINUE;
|
||||||
|
else {
|
||||||
struct fc_result arg;
|
struct fc_result arg;
|
||||||
struct fc_result *list;
|
struct fc_result *list;
|
||||||
|
|
||||||
|
|
||||||
if (!RCLASS(value)->iv_tbl) return ST_CONTINUE;
|
|
||||||
|
|
||||||
list = res;
|
list = res;
|
||||||
while (list) {
|
while (list) {
|
||||||
if (list->track == value) return ST_CONTINUE;
|
if (list->track == value) return ST_CONTINUE;
|
||||||
list = list->prev;
|
list = list->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
arg.name = 0;
|
arg.name = key;
|
||||||
arg.path = path;
|
arg.path = 0;
|
||||||
arg.klass = res->klass;
|
arg.klass = res->klass;
|
||||||
arg.track = value;
|
arg.track = value;
|
||||||
arg.prev = res;
|
arg.prev = res;
|
||||||
st_foreach(RCLASS(value)->iv_tbl, fc_i, &arg);
|
st_foreach(RCLASS(value)->iv_tbl, fc_i, &arg);
|
||||||
if (arg.name) {
|
if (arg.path) {
|
||||||
res->name = arg.name;
|
|
||||||
res->path = arg.path;
|
res->path = arg.path;
|
||||||
return ST_STOP;
|
return ST_STOP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,10 +125,10 @@ find_class_path(klass)
|
||||||
if (RCLASS(rb_cObject)->iv_tbl) {
|
if (RCLASS(rb_cObject)->iv_tbl) {
|
||||||
st_foreach(RCLASS(rb_cObject)->iv_tbl, fc_i, &arg);
|
st_foreach(RCLASS(rb_cObject)->iv_tbl, fc_i, &arg);
|
||||||
}
|
}
|
||||||
if (arg.name == 0) {
|
if (arg.path == 0) {
|
||||||
st_foreach(rb_class_tbl, fc_i, &arg);
|
st_foreach(rb_class_tbl, fc_i, &arg);
|
||||||
}
|
}
|
||||||
if (arg.name) {
|
if (arg.path) {
|
||||||
st_insert(ROBJECT(klass)->iv_tbl,rb_intern("__classpath__"),arg.path);
|
st_insert(ROBJECT(klass)->iv_tbl,rb_intern("__classpath__"),arg.path);
|
||||||
return arg.path;
|
return arg.path;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.6.4"
|
#define RUBY_VERSION "1.6.4"
|
||||||
#define RUBY_RELEASE_DATE "2001-06-05"
|
#define RUBY_RELEASE_DATE "2001-06-06"
|
||||||
#define RUBY_VERSION_CODE 164
|
#define RUBY_VERSION_CODE 164
|
||||||
#define RUBY_RELEASE_CODE 20010605
|
#define RUBY_RELEASE_CODE 20010606
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue