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>
|
||||
|
||||
* eval.c (rb_add_method): should not call rb_secure(), for
|
||||
|
|
7
eval.c
7
eval.c
|
@ -5128,12 +5128,7 @@ rb_load(fname, wrap)
|
|||
NODE *saved_cref = ruby_cref;
|
||||
TMP_PROTECT;
|
||||
|
||||
if (wrap) {
|
||||
Check_Type(fname, T_STRING);
|
||||
}
|
||||
else {
|
||||
Check_SafeStr(fname);
|
||||
}
|
||||
Check_SafeStr(fname);
|
||||
file = rb_find_file(RSTRING(fname)->ptr);
|
||||
if (!file) {
|
||||
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++;
|
||||
EXTRACT_NUMBER_AND_INCR(mcnt, laststart);
|
||||
if (mcnt == 4 && *laststart == anychar) {
|
||||
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) {
|
||||
if (*laststart == charset || *laststart == charset_not) {
|
||||
p0 = laststart;
|
||||
mcnt = *++p0;
|
||||
p0 += mcnt+1;
|
||||
|
|
90
variable.c
90
variable.c
|
@ -36,6 +36,33 @@ struct fc_result {
|
|||
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
|
||||
fc_i(key, value, res)
|
||||
ID key;
|
||||
|
@ -43,48 +70,43 @@ fc_i(key, value, res)
|
|||
struct fc_result *res;
|
||||
{
|
||||
VALUE path;
|
||||
char *name;
|
||||
|
||||
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) {
|
||||
res->name = key;
|
||||
res->path = path;
|
||||
res->path = fc_path(res, key);
|
||||
return ST_STOP;
|
||||
}
|
||||
if (rb_obj_is_kind_of(value, rb_cModule)) {
|
||||
struct fc_result arg;
|
||||
struct fc_result *list;
|
||||
|
||||
|
||||
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 *list;
|
||||
|
||||
list = res;
|
||||
while (list) {
|
||||
if (list->track == value) return ST_CONTINUE;
|
||||
list = list->prev;
|
||||
}
|
||||
list = res;
|
||||
while (list) {
|
||||
if (list->track == value) return ST_CONTINUE;
|
||||
list = list->prev;
|
||||
}
|
||||
|
||||
arg.name = 0;
|
||||
arg.path = path;
|
||||
arg.klass = res->klass;
|
||||
arg.track = value;
|
||||
arg.prev = res;
|
||||
st_foreach(RCLASS(value)->iv_tbl, fc_i, &arg);
|
||||
if (arg.name) {
|
||||
res->name = arg.name;
|
||||
res->path = arg.path;
|
||||
return ST_STOP;
|
||||
arg.name = key;
|
||||
arg.path = 0;
|
||||
arg.klass = res->klass;
|
||||
arg.track = value;
|
||||
arg.prev = res;
|
||||
st_foreach(RCLASS(value)->iv_tbl, fc_i, &arg);
|
||||
if (arg.path) {
|
||||
res->path = arg.path;
|
||||
return ST_STOP;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
@ -103,10 +125,10 @@ find_class_path(klass)
|
|||
if (RCLASS(rb_cObject)->iv_tbl) {
|
||||
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);
|
||||
}
|
||||
if (arg.name) {
|
||||
if (arg.path) {
|
||||
st_insert(ROBJECT(klass)->iv_tbl,rb_intern("__classpath__"),arg.path);
|
||||
return arg.path;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,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_RELEASE_CODE 20010605
|
||||
#define RUBY_RELEASE_CODE 20010606
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue