diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-29 04:37:52 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-29 04:37:52 +0000 |
commit | 1fe57a4b5d4d8673e9841f99b23d1935537a855a (patch) | |
tree | 7d76f14c2194e897744000797b80a39171c209c6 /vm_method.c | |
parent | 5e4d04c36e33dc23a06cd6e5b53f5e7bef4394f7 (diff) | |
download | bundler-1fe57a4b5d4d8673e9841f99b23d1935537a855a.tar.gz |
* vm_method.c (rb_add_method_def): nothing to do if old method had
same definition. [ruby-dev:39397]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/vm_method.c b/vm_method.c index 3eef4449df..434e8424cc 100644 --- a/vm_method.c +++ b/vm_method.c @@ -141,6 +141,8 @@ rb_free_method_entry(rb_method_entry_t *me) xfree(me); } +static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2); + static rb_method_entry_t * rb_add_method_def(VALUE klass, ID mid, rb_method_type_t type, rb_method_definition_t *def, rb_method_flag_t noex) { @@ -179,7 +181,7 @@ rb_add_method_def(VALUE klass, ID mid, rb_method_type_t type, rb_method_definiti rb_method_entry_t *old_me = (rb_method_entry_t *)data; rb_method_definition_t *old_def = old_me->def; - if (old_def == def) return old_me; + if (rb_method_definition_eq(old_def, def)) return old_me; rb_vm_check_redefinition_opt_method(old_me); if (RTEST(ruby_verbose) && @@ -791,7 +793,12 @@ rb_mod_protected_method_defined(VALUE mod, VALUE mid) int rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2) { - const rb_method_definition_t *d1 = m1->def, *d2 = m2->def; + return rb_method_definition_eq(m1->def, m2->def); +} + +static int +rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2) +{ if (!d1) { return !d2; } |