* eval.c (proc_invoke): nail down dyna_var node when Proc object

or continuation is created.  [ruby-dev:24671]

* io.c (rb_io_s_popen): do not expand argv array.  [ruby-dev:24670]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-11-01 23:49:16 +00:00
Родитель c2d8185ba6
Коммит 1d1b8102bc
6 изменённых файлов: 47 добавлений и 61 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Tue Nov 2 01:20:09 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (proc_invoke): nail down dyna_var node when Proc object
or continuation is created. [ruby-dev:24671]
* io.c (rb_io_s_popen): do not expand argv array. [ruby-dev:24670]
Mon Nov 1 22:25:56 2004 Kouhei Sutou <kou@cozmixng.org> Mon Nov 1 22:25:56 2004 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/maker/base.rb: changed xml-stylesheet's API of RSS Maker * lib/rss/maker/base.rb: changed xml-stylesheet's API of RSS Maker
@ -32,6 +39,14 @@ Mon Nov 1 09:37:19 2004 Kouhei Sutou <kou@cozmixng.org>
* lib/rss/maker.rb: added entry point of RSS Maker. * lib/rss/maker.rb: added entry point of RSS Maker.
Mon Nov 1 03:14:14 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_get_method_body): store ICLASS in the cache.
[ruby-core:03672]
* eval.c (rb_provided): should return true for loading library
too for autoloading. [ruby-core:03655]
Mon Nov 1 01:14:52 2004 Yukihiro Matsumoto <matz@ruby-lang.org> Mon Nov 1 01:14:52 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_f_open): create copy of popen specifier. [ruby-dev:24656] * io.c (rb_f_open): create copy of popen specifier. [ruby-dev:24656]

59
eval.c
Просмотреть файл

@ -412,7 +412,6 @@ rb_get_method_body(klassp, idp, noexp)
if (ruby_running) { if (ruby_running) {
/* store in cache */ /* store in cache */
if (BUILTIN_TYPE(origin) == T_ICLASS) origin = RBASIC(origin)->klass;
ent = cache + EXPR1(klass, id); ent = cache + EXPR1(klass, id);
ent->klass = klass; ent->klass = klass;
ent->noex = body->nd_noex; ent->noex = body->nd_noex;
@ -2177,18 +2176,6 @@ arg_defined(self, node, buf, type)
return type; return type;
} }
static VALUE
search_iclass(self, klass)
VALUE self, klass;
{
VALUE k = CLASS_OF(self);
while (k && !(BUILTIN_TYPE(k) == T_ICLASS && RBASIC(k)->klass == klass)) {
k = RCLASS(k)->super;
}
return k;
}
static const char* static const char*
is_defined(self, node, buf, noeval) is_defined(self, node, buf, noeval)
VALUE self; VALUE self;
@ -2207,10 +2194,6 @@ is_defined(self, node, buf, noeval)
if (ruby_frame->orig_func == 0) return 0; if (ruby_frame->orig_func == 0) return 0;
else if (ruby_frame->last_class == 0) return 0; else if (ruby_frame->last_class == 0) return 0;
val = ruby_frame->last_class; val = ruby_frame->last_class;
if (BUILTIN_TYPE(val) == T_MODULE) {
val = search_iclass(self, val);
if (!val) return 0;
}
if (rb_method_boundp(RCLASS(val)->super, ruby_frame->orig_func, 0)) { if (rb_method_boundp(RCLASS(val)->super, ruby_frame->orig_func, 0)) {
if (nd_type(node) == NODE_SUPER) { if (nd_type(node) == NODE_SUPER) {
return arg_defined(self, node->nd_args, buf, "super"); return arg_defined(self, node->nd_args, buf, "super");
@ -5861,20 +5844,6 @@ rb_call_super(argc, argv)
self = ruby_frame->self; self = ruby_frame->self;
klass = ruby_frame->last_class; klass = ruby_frame->last_class;
if (BUILTIN_TYPE(klass) == T_MODULE) {
k = search_iclass(self, klass);
if (!k) {
rb_raise(rb_eTypeError, "%s is not included in %s",
rb_class2name(klass),
rb_class2name(CLASS_OF(self)));
}
if (RCLASS(k)->super == 0) {
rb_name_error(ruby_frame->last_func,
"super: no superclass method `%s'",
rb_id2name(ruby_frame->last_func));
}
klass = k;
}
PUSH_ITER(ruby_iter->iter ? ITER_PRE : ITER_NOT); PUSH_ITER(ruby_iter->iter ? ITER_PRE : ITER_NOT);
result = rb_call(RCLASS(klass)->super, self, ruby_frame->orig_func, argc, argv, 3); result = rb_call(RCLASS(klass)->super, self, ruby_frame->orig_func, argc, argv, 3);
@ -6623,7 +6592,21 @@ int
rb_provided(feature) rb_provided(feature)
const char *feature; const char *feature;
{ {
return rb_feature_p(feature, 0, Qfalse) ? Qtrue : Qfalse; int i;
char *buf;
if (rb_feature_p(feature, 0, Qfalse))
return Qtrue;
if (!loading_tbl) return Qfalse;
if (st_lookup(loading_tbl, (st_data_t)feature, 0)) return Qtrue;
buf = ALLOCA_N(char, strlen(feature)+8);
strcpy(buf, feature);
for (i=0; ; i++) {
if (!loadable_ext[i]) break;
strcpy(buf+strlen(feature), loadable_ext[i]);
if (st_lookup(loading_tbl, (st_data_t)buf, 0)) return Qtrue;
}
return Qfalse;
} }
static void static void
@ -8112,7 +8095,6 @@ proc_invoke(proc, args, self, klass)
int state; int state;
volatile int safe = ruby_safe_level; volatile int safe = ruby_safe_level;
volatile VALUE old_wrapper = ruby_wrapper; volatile VALUE old_wrapper = ruby_wrapper;
struct RVarmap * volatile old_dvars = ruby_dyna_vars;
volatile int pcall, avalue = Qtrue; volatile int pcall, avalue = Qtrue;
VALUE bvar = Qnil; VALUE bvar = Qnil;
@ -8129,6 +8111,7 @@ proc_invoke(proc, args, self, klass)
args = RARRAY(args)->ptr[0]; args = RARRAY(args)->ptr[0];
} }
PUSH_VARS();
ruby_wrapper = data->wrapper; ruby_wrapper = data->wrapper;
ruby_dyna_vars = data->dyna_vars; ruby_dyna_vars = data->dyna_vars;
/* PUSH BLOCK from data */ /* PUSH BLOCK from data */
@ -8155,15 +8138,7 @@ proc_invoke(proc, args, self, klass)
POP_ITER(); POP_ITER();
ruby_block = old_block; ruby_block = old_block;
ruby_wrapper = old_wrapper; ruby_wrapper = old_wrapper;
if (FL_TEST(ruby_dyna_vars, DVAR_DONT_RECYCLE)) { POP_VARS();
struct RVarmap *vars;
for (vars = old_dvars; vars; vars = vars->next) {
if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
FL_SET(vars, DVAR_DONT_RECYCLE);
}
}
ruby_dyna_vars = old_dvars;
if (proc_safe_level_p(proc)) ruby_safe_level = safe; if (proc_safe_level_p(proc)) ruby_safe_level = safe;
switch (state) { switch (state) {

28
io.c
Просмотреть файл

@ -2793,7 +2793,7 @@ pipe_open(argc, argv, pname, mode)
argc = 0; argc = 0;
prog = argv[0]; prog = argv[0];
} }
pname = StringValuePtr(prog); pname = StringValueCStr(prog);
} }
cmd = pname; cmd = pname;
@ -2971,25 +2971,21 @@ rb_io_s_popen(argc, argv, klass)
} }
tmp = rb_check_array_type(pname); tmp = rb_check_array_type(pname);
if (!NIL_P(tmp)) { if (!NIL_P(tmp)) {
long argc = RARRAY(tmp)->len; pname = tmp;
VALUE *argv = ALLOCA_N(VALUE, argc);
MEMCPY(argv, RARRAY(tmp)->ptr, VALUE, argc);
port = pipe_open(argc, argv, 0, mode);
} }
else { else {
SafeStringValue(pname); SafeStringValue(pname);
port = pipe_open(1, &pname, 0, mode); }
if (NIL_P(port)) { port = pipe_open(1, &pname, 0, mode);
/* child */ if (NIL_P(port)) {
if (rb_block_given_p()) { /* child */
rb_yield(Qnil); if (rb_block_given_p()) {
fflush(stdout); rb_yield(Qnil);
fflush(stderr); fflush(stdout);
_exit(0); fflush(stderr);
} _exit(0);
return Qnil;
} }
return Qnil;
} }
RBASIC(port)->klass = klass; RBASIC(port)->klass = klass;
if (rb_block_given_p()) { if (rb_block_given_p()) {

Просмотреть файл

@ -1023,7 +1023,7 @@ class CGI
content_length -= c.size content_length -= c.size
end end
buf = buf.sub(/\A((?:.|\n)*?)(?:#{EOL})?#{boundary}(#{EOL}|#{LF}|--)/n) do buf = buf.sub(/\A((?:.|\n)*?)(?:[\r\n]{1,2})?#{boundary}([\r\n]{1,2}|--)/n) do
body.print $1 body.print $1
if "--" == $2 if "--" == $2
content_length = -1 content_length = -1

Просмотреть файл

@ -4922,7 +4922,6 @@ onig_end()
return 0; return 0;
} }
#ifdef ONIG_DEBUG #ifdef ONIG_DEBUG
OnigOpInfoType OnigOpInfo[] = { OnigOpInfoType OnigOpInfo[] = {

Просмотреть файл

@ -2206,7 +2206,8 @@ match_at(regex_t* reg, UChar* str, UChar* end, UChar* sstart,
repeat_inc_ng: repeat_inc_ng:
stkp->u.repeat.count++; stkp->u.repeat.count++;
if (stkp->u.repeat.count < reg->repeat_range[mem].upper) { if (stkp->u.repeat.count < reg->repeat_range[mem].upper
|| reg->repeat_range[mem].upper < 0 /* IS_REPEAT_INFINITE(upper) */) {
if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) { if (stkp->u.repeat.count >= reg->repeat_range[mem].lower) {
UChar* pcode = stkp->u.repeat.pcode; UChar* pcode = stkp->u.repeat.pcode;