зеркало из https://github.com/github/ruby.git
rb_rescue / rb_rescue2 now free from ANYARGS
After 5e86b005c0
, I now think ANYARGS is
dangerous and should be extinct. This commit deletes ANYARGS from
rb_rescue / rb_rescue2, which revealed many arity / type mismatches.
This commit is contained in:
Родитель
3cae73133c
Коммит
5c7c2d9951
6
enum.c
6
enum.c
|
@ -2723,14 +2723,16 @@ zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
|
|||
}
|
||||
|
||||
static VALUE
|
||||
call_next(VALUE *v)
|
||||
call_next(VALUE w)
|
||||
{
|
||||
VALUE *v = (VALUE *)w;
|
||||
return v[0] = rb_funcallv(v[1], id_next, 0, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
call_stop(VALUE *v)
|
||||
call_stop(VALUE w, VALUE _)
|
||||
{
|
||||
VALUE *v = (VALUE *)w;
|
||||
return v[0] = Qundef;
|
||||
}
|
||||
|
||||
|
|
|
@ -2231,7 +2231,7 @@ call_next(VALUE obj)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
next_stopped(VALUE obj)
|
||||
next_stopped(VALUE obj, VALUE _)
|
||||
{
|
||||
return Qnil;
|
||||
}
|
||||
|
|
8
eval.c
8
eval.c
|
@ -931,8 +931,8 @@ rb_need_block(void)
|
|||
* \ingroup exception
|
||||
*/
|
||||
VALUE
|
||||
rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
|
||||
VALUE (* r_proc) (ANYARGS), VALUE data2, ...)
|
||||
rb_rescue2(VALUE (* b_proc) (VALUE), VALUE data1,
|
||||
VALUE (* r_proc) (VALUE, VALUE), VALUE data2, ...)
|
||||
{
|
||||
enum ruby_tag_type state;
|
||||
rb_execution_context_t * volatile ec = GET_EC();
|
||||
|
@ -1003,8 +1003,8 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
|
|||
* \ingroup exception
|
||||
*/
|
||||
VALUE
|
||||
rb_rescue(VALUE (* b_proc)(ANYARGS), VALUE data1,
|
||||
VALUE (* r_proc)(ANYARGS), VALUE data2)
|
||||
rb_rescue(VALUE (* b_proc)(VALUE), VALUE data1,
|
||||
VALUE (* r_proc)(VALUE, VALUE), VALUE data2)
|
||||
{
|
||||
return rb_rescue2(b_proc, data1, r_proc, data2, rb_eStandardError,
|
||||
(VALUE)0);
|
||||
|
|
|
@ -140,7 +140,7 @@ static void gzfile_reset(struct gzfile*);
|
|||
static void gzfile_close(struct gzfile*, int);
|
||||
static void gzfile_write_raw(struct gzfile*);
|
||||
static VALUE gzfile_read_raw_partial(VALUE);
|
||||
static VALUE gzfile_read_raw_rescue(VALUE);
|
||||
static VALUE gzfile_read_raw_rescue(VALUE,VALUE);
|
||||
static VALUE gzfile_read_raw(struct gzfile*, VALUE outbuf);
|
||||
static int gzfile_read_raw_ensure(struct gzfile*, long, VALUE outbuf);
|
||||
static char *gzfile_read_raw_until_zero(struct gzfile*, long);
|
||||
|
@ -2385,7 +2385,7 @@ gzfile_read_raw_partial(VALUE arg)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
gzfile_read_raw_rescue(VALUE arg)
|
||||
gzfile_read_raw_rescue(VALUE arg, VALUE _)
|
||||
{
|
||||
struct read_raw_arg *ra = (struct read_raw_arg *)arg;
|
||||
VALUE str = Qnil;
|
||||
|
@ -4888,5 +4888,3 @@ Init_zlib(void)
|
|||
* Raised when the data length recorded in the gzip file footer is not equivalent
|
||||
* to the length of the actual uncompressed data.
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -1966,8 +1966,8 @@ int rb_block_given_p(void);
|
|||
void rb_need_block(void);
|
||||
VALUE rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE);
|
||||
VALUE rb_block_call(VALUE,ID,int,const VALUE*,rb_block_call_func_t,VALUE);
|
||||
VALUE rb_rescue(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
|
||||
VALUE rb_rescue2(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE,...);
|
||||
VALUE rb_rescue(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE);
|
||||
VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
|
||||
VALUE rb_ensure(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
|
||||
VALUE rb_catch(const char*,VALUE(*)(ANYARGS),VALUE);
|
||||
VALUE rb_catch_obj(VALUE,VALUE(*)(ANYARGS),VALUE);
|
||||
|
|
2
io.c
2
io.c
|
@ -11457,7 +11457,7 @@ copy_stream_fallback(struct copy_stream_struct *stp)
|
|||
rb_raise(rb_eArgError, "cannot specify src_offset for non-IO");
|
||||
}
|
||||
rb_rescue2(copy_stream_fallback_body, (VALUE)stp,
|
||||
(VALUE (*) (ANYARGS))0, (VALUE)0,
|
||||
(VALUE (*) (VALUE, VALUE))0, (VALUE)0,
|
||||
rb_eEOFError, (VALUE)0);
|
||||
return Qnil;
|
||||
}
|
||||
|
|
2
time.c
2
time.c
|
@ -5204,7 +5204,7 @@ mload_zone(VALUE time, VALUE zone)
|
|||
VALUE z, args[2];
|
||||
args[0] = time;
|
||||
args[1] = zone;
|
||||
z = rb_rescue(mload_findzone, (VALUE)args, (VALUE (*)(ANYARGS))NULL, Qnil);
|
||||
z = rb_rescue(mload_findzone, (VALUE)args, 0, Qnil);
|
||||
if (NIL_P(z)) return rb_fstring(zone);
|
||||
if (RB_TYPE_P(z, T_STRING)) return rb_fstring(z);
|
||||
return z;
|
||||
|
|
|
@ -322,16 +322,18 @@ struct rescue_funcall_args {
|
|||
};
|
||||
|
||||
static VALUE
|
||||
check_funcall_exec(struct rescue_funcall_args *args)
|
||||
check_funcall_exec(VALUE v)
|
||||
{
|
||||
struct rescue_funcall_args *args = (void *)v;
|
||||
return call_method_entry(args->ec, args->defined_class,
|
||||
args->recv, idMethodMissing,
|
||||
args->me, args->argc, args->argv);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
check_funcall_failed(struct rescue_funcall_args *args, VALUE e)
|
||||
check_funcall_failed(VALUE v, VALUE e)
|
||||
{
|
||||
struct rescue_funcall_args *args = (void *)v;
|
||||
int ret = args->respond;
|
||||
if (!ret) {
|
||||
switch (rb_method_boundp(args->defined_class, args->mid,
|
||||
|
@ -1075,7 +1077,7 @@ rb_yield_block(VALUE val, VALUE arg, int argc, const VALUE *argv, VALUE blockarg
|
|||
}
|
||||
|
||||
static VALUE
|
||||
loop_i(void)
|
||||
loop_i(VALUE _)
|
||||
{
|
||||
for (;;) {
|
||||
rb_yield_0(0, 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче