From 7b3ed7c0bed876efe5298232a49f8542b8b340a0 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 21 May 2017 04:30:09 +0000 Subject: SQUASH/WIP - use rb_funcallv to handle second respond_to arg While we're at it, avoid mixing declarations and code in case there's still compiler compatibility problems. (We will add a check for -Wdeclaration-after-statement support in a separate commit) --- ext/clogger_ext/clogger.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'ext/clogger_ext/clogger.c') diff --git a/ext/clogger_ext/clogger.c b/ext/clogger_ext/clogger.c index 622c98c..daed91a 100644 --- a/ext/clogger_ext/clogger.c +++ b/ext/clogger_ext/clogger.c @@ -965,16 +965,19 @@ static VALUE clogger_init_copy(VALUE clone, VALUE orig) */ static VALUE respond_to(int argc, VALUE *argv, VALUE self) { - VALUE method, include_all; - rb_scan_args(argc, argv, "11", &method, &include_all); - if (NIL_P(include_all)) include_all = Qfalse; - struct clogger *c = clogger_get(self); - ID id = rb_to_id(method); + VALUE method, include_all; + ID id; + rb_scan_args(argc, argv, "11", &method, &include_all); + id = rb_to_id(method); if (close_id == id) return Qtrue; - return rb_respond_to(c->body, id); + + if (argc == 1) + return rb_respond_to(c->body, id); + + return rb_funcallv(c->body, respond_to_id, argc, argv); } /* -- cgit v1.2.3-24-ge0c7