commit 7b3ed7c0bed876efe5298232a49f8542b8b340a0 (patch)
parent e10ef64 Update respond_to? calls for second argument.
tree 391ba7228b4eb7c640dae4b2e8fdc11dc2c9070d
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
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(-)
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);
}
/*
glossary
--------
Commit objects reference one tree, and zero or more parents.
Single parent commits can typically generate a patch in
unified diff format via `git format-patch'.
Multiple parents means the commit is a merge.
Root commits have no ancestor. Note that it is
possible to have multiple root commits when merging independent histories.
Every commit references one top-level tree object.
git clone https://yhbt.net/clogger.git