diff options
author | Eric Wong <e@80x24.org> | 2017-05-21 04:30:09 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-05-21 04:30:09 +0000 |
commit | 7b3ed7c0bed876efe5298232a49f8542b8b340a0 (patch) | |
tree | 391ba7228b4eb7c640dae4b2e8fdc11dc2c9070d /ext | |
parent | e10ef6433f47f6152b776237c5f408e35c186dce (diff) | |
download | clogger-respond_to-priv.tar.gz |
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)
Diffstat (limited to 'ext')
-rw-r--r-- | ext/clogger_ext/clogger.c | 15 |
1 files changed, 9 insertions, 6 deletions
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); } /* |