* eval.c (rb_proc_new): call svalue_to_avalue for yield argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-07-16 09:23:33 +00:00
Родитель 1d3b7cfd74
Коммит 0eb5a42b91
2 изменённых файлов: 27 добавлений и 1 удалений

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

@ -1,3 +1,7 @@
Wed Jul 16 16:23:58 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_proc_new): call svalue_to_avalue for yield argument.
Wed Jul 16 00:31:00 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_disable_super, rb_enable_super): deprecate.

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

@ -7553,12 +7553,29 @@ bmcall(args, method)
return method_call(RARRAY(a)->len, RARRAY(a)->ptr, method);
}
struct proc_funcall_data {
VALUE (*func)(ANYARGS);
VALUE val;
};
static VALUE
proc_funcall(args, data)
VALUE args;
struct proc_funcall_data *data;
{
return (*data->func)(svalue_to_avalue(args), data->val);
}
VALUE
rb_proc_new(func, val)
VALUE (*func)(ANYARGS); /* VALUE yieldarg[, VALUE procarg] */
VALUE val;
{
return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, func, val);
struct proc_funcall_data data;
data.func = func;
data.val = val;
return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, proc_funcall, (VALUE)&data);
}
static VALUE
@ -9256,6 +9273,11 @@ rb_thread_start_0(fn, arg, th_arg)
enum thread_status status;
int state;
if (OBJ_FROZEN(curr_thread->thgroup)) {
rb_raise(rb_eThreadError,
"can't start a new thread (frozen ThreadGroup)");
}
#if defined(HAVE_SETITIMER)
if (!thread_init) {
#ifdef POSIX_SIGNAL