clogger RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] replace deprecated rb_iterate with rb_block_call
@ 2024-02-02  7:46 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2024-02-02  7:46 UTC (permalink / raw)
  To: clogger-public

While rb_block_call appeared in Ruby 1.9,
RB_BLOCK_CALL_FUNC_ARGLIST only appeared in 2.1
---
 clogger.gemspec           | 1 +
 ext/clogger_ext/clogger.c | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/clogger.gemspec b/clogger.gemspec
index 7a08dc5..306ed3b 100644
--- a/clogger.gemspec
+++ b/clogger.gemspec
@@ -5,6 +5,7 @@
   s.name = %q{clogger}
   s.version = (ENV['VERSION'] || '2.4.0').dup
   s.homepage = 'https://YHBT.net/clogger/'
+  s.required_ruby_version = ">= 2.1.0"
   s.authors = ["cloggers"]
   s.summary = 'configurable request logging for Rack'
   s.description = File.read('README').split("\n\n")[1]
diff --git a/ext/clogger_ext/clogger.c b/ext/clogger_ext/clogger.c
index cea4072..29c23b4 100644
--- a/ext/clogger_ext/clogger.c
+++ b/ext/clogger_ext/clogger.c
@@ -134,6 +134,7 @@ static ID sq_brace_id;
 static ID new_id;
 static ID to_path_id;
 static ID respond_to_id;
+static ID each_id;
 static VALUE cClogger;
 static VALUE mFormat;
 static VALUE cRackHeaders;
@@ -840,7 +841,7 @@ static VALUE clogger_init(int argc, VALUE *argv, VALUE self)
 	return self;
 }
 
-static VALUE body_iter_i(VALUE str, VALUE self)
+static VALUE body_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(str, self))
 {
 	struct clogger *c = clogger_get(self);
 
@@ -873,7 +874,7 @@ static VALUE clogger_each(VALUE self)
 
 	rb_need_block();
 	c->body_bytes_sent = 0;
-	rb_iterate(rb_each, c->body, body_iter_i, self);
+	rb_block_call(c->body, each_id, 0, NULL, body_iter_i, self);
 
 	return self;
 }
@@ -1098,6 +1099,7 @@ void Init_clogger_ext(void)
 	new_id = rb_intern("new");
 	to_path_id = rb_intern("to_path");
 	respond_to_id = rb_intern("respond_to?");
+	each_id = rb_intern("each");
 	cClogger = rb_define_class("Clogger", rb_cObject);
 	mFormat = rb_define_module_under(cClogger, "Format");
 	rb_define_alloc_func(cClogger, clogger_alloc);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-02  7:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02  7:46 [PATCH] replace deprecated rb_iterate with rb_block_call Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/clogger.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).