[前][次][番号順一覧][スレッド一覧]

ruby-changes:57336

From: Nobuyoshi <ko1@a...>
Date: Wed, 28 Aug 2019 00:11:59 +0900 (JST)
Subject: [ruby-changes:57336] Nobuyoshi Nakada: 6a0d2bc2af (master): Follows callback declaration updates

https://git.ruby-lang.org/ruby.git/commit/?id=6a0d2bc2af

From 6a0d2bc2af7597e3e308c949e01c8e6329107b47 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 28 Aug 2019 00:09:01 +0900
Subject: Follows callback declaration updates


diff --git a/spec/ruby/optional/capi/ext/array_spec.c b/spec/ruby/optional/capi/ext/array_spec.c
index 56f91d0..69cb035 100644
--- a/spec/ruby/optional/capi/ext/array_spec.c
+++ b/spec/ruby/optional/capi/ext/array_spec.c
@@ -166,7 +166,7 @@ static VALUE array_spec_rb_assoc_new(VALUE self, VALUE first, VALUE second) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/array_spec.c#L166
   return rb_assoc_new(first, second);
 }
 
-static VALUE copy_ary(VALUE el, VALUE new_ary) {
+static VALUE copy_ary(RB_BLOCK_CALL_FUNC_ARGLIST(el, new_ary)) {
   return rb_ary_push(new_ary, el);
 }
 
@@ -178,7 +178,7 @@ static VALUE array_spec_rb_iterate(VALUE self, VALUE ary) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/array_spec.c#L178
   return new_ary;
 }
 
-static VALUE sub_pair(VALUE el, VALUE holder) {
+static VALUE sub_pair(RB_BLOCK_CALL_FUNC_ARGLIST(el, holder)) {
   return rb_ary_push(holder, rb_ary_entry(el, 1));
 }
 
@@ -194,7 +194,7 @@ static VALUE array_spec_rb_iterate_each_pair(VALUE self, VALUE obj) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/array_spec.c#L194
   return new_ary;
 }
 
-static VALUE iter_yield(VALUE el, VALUE ary) {
+static VALUE iter_yield(RB_BLOCK_CALL_FUNC_ARGLIST(el, ary)) {
   rb_yield(el);
   return Qnil;
 }
diff --git a/spec/ruby/optional/capi/ext/kernel_spec.c b/spec/ruby/optional/capi/ext/kernel_spec.c
index ed6e08a..0e8827c 100644
--- a/spec/ruby/optional/capi/ext/kernel_spec.c
+++ b/spec/ruby/optional/capi/ext/kernel_spec.c
@@ -13,6 +13,10 @@ VALUE kernel_spec_call_proc(VALUE arg_array) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/kernel_spec.c#L13
   return rb_funcall(proc, rb_intern("call"), 1, arg);
 }
 
+VALUE kernel_spec_call_proc_raise(VALUE arg_array, VALUE raised_exc) {
+  return kernel_spec_call_proc(arg_array);
+}
+
 static VALUE kernel_spec_rb_block_given_p(VALUE self) {
   return rb_block_given_p() ? Qtrue : Qfalse;
 }
@@ -30,7 +34,7 @@ VALUE kernel_spec_rb_block_lambda(VALUE self) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/kernel_spec.c#L34
   return rb_block_lambda();
 }
 
-VALUE block_call_inject(VALUE yield_value, VALUE data2) {
+VALUE block_call_inject(RB_BLOCK_CALL_FUNC_ARGLIST(yield_value, data2)) {
   /* yield_value yields the first block argument */
   VALUE elem = yield_value;
   VALUE elem_incr = INT2FIX(FIX2INT(elem) + 1);
@@ -41,7 +45,7 @@ VALUE kernel_spec_rb_block_call(VALUE self, VALUE ary) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/kernel_spec.c#L45
   return rb_block_call(ary, rb_intern("map"), 0, NULL, block_call_inject, Qnil);
 }
 
-VALUE block_call_inject_multi_arg(VALUE yield_value, VALUE data2, int argc, VALUE argv[]) {
+VALUE block_call_inject_multi_arg(RB_BLOCK_CALL_FUNC_ARGLIST(yield_value, data2)) {
   /* yield_value yields the first block argument */
   VALUE sum  = yield_value;
   VALUE elem = argv[1];
@@ -80,7 +84,7 @@ VALUE kernel_spec_rb_ensure(VALUE self, VALUE main_proc, VALUE arg, https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/kernel_spec.c#L84
       kernel_spec_call_proc, ensure_array);
 }
 
-VALUE kernel_spec_call_proc_with_catch(VALUE arg, VALUE data) {
+VALUE kernel_spec_call_proc_with_catch(RB_BLOCK_CALL_FUNC_ARGLIST(arg, data)) {
   return rb_funcall(data, rb_intern("call"), 0);
 }
 
@@ -88,7 +92,7 @@ VALUE kernel_spec_rb_catch(VALUE self, VALUE sym, VALUE main_proc) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/kernel_spec.c#L92
   return rb_catch(StringValuePtr(sym), kernel_spec_call_proc_with_catch, main_proc);
 }
 
-VALUE kernel_spec_call_proc_with_catch_obj(VALUE arg, VALUE data) {
+VALUE kernel_spec_call_proc_with_catch_obj(RB_BLOCK_CALL_FUNC_ARGLIST(arg, data)) {
   return rb_funcall(data, rb_intern("call"), 0);
 }
 
@@ -161,7 +165,7 @@ VALUE kernel_spec_rb_rescue2(int argc, VALUE *args, VALUE self) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/kernel_spec.c#L165
   rb_ary_push(raise_array, args[3]);
 
   return rb_rescue2(kernel_spec_call_proc, main_array,
-      kernel_spec_call_proc, raise_array, args[4], args[5], (VALUE)0);
+      kernel_spec_call_proc_raise, raise_array, args[4], args[5], (VALUE)0);
 }
 
 static VALUE kernel_spec_rb_protect_yield(VALUE self, VALUE obj, VALUE ary) {
diff --git a/spec/ruby/optional/capi/ext/proc_spec.c b/spec/ruby/optional/capi/ext/proc_spec.c
index 67dd857..18fd199 100644
--- a/spec/ruby/optional/capi/ext/proc_spec.c
+++ b/spec/ruby/optional/capi/ext/proc_spec.c
@@ -7,7 +7,7 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/proc_spec.c#L7
 extern "C" {
 #endif
 
-VALUE proc_spec_rb_proc_new_function(VALUE args) {
+VALUE proc_spec_rb_proc_new_function(RB_BLOCK_CALL_FUNC_ARGLIST(args, dummy)) {
   return rb_funcall(args, rb_intern("inspect"), 0);
 }
 
diff --git a/spec/ruby/optional/capi/ext/thread_spec.c b/spec/ruby/optional/capi/ext/thread_spec.c
index 2f5678c..139652e 100644
--- a/spec/ruby/optional/capi/ext/thread_spec.c
+++ b/spec/ruby/optional/capi/ext/thread_spec.c
@@ -114,7 +114,8 @@ static VALUE thread_spec_rb_thread_wait_for(VALUE self, VALUE s, VALUE ms) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/thread_spec.c#L114
 }
 
 
-VALUE thread_spec_call_proc(VALUE arg_array) {
+VALUE thread_spec_call_proc(void *arg_ptr) {
+  VALUE arg_array = (VALUE)arg_ptr;
   VALUE arg = rb_ary_pop(arg_array);
   VALUE proc = rb_ary_pop(arg_array);
   return rb_funcall(proc, rb_intern("call"), 1, arg);
@@ -125,7 +126,7 @@ static VALUE thread_spec_rb_thread_create(VALUE self, VALUE proc, VALUE arg) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/thread_spec.c#L126
   rb_ary_push(args, proc);
   rb_ary_push(args, arg);
 
-  return rb_thread_create((VALUE (*)(void *))thread_spec_call_proc, (void*)args);
+  return rb_thread_create(thread_spec_call_proc, (void*)args);
 }
 
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]