From 67245eec7192abdc1dd0dc2510c1f6c77df89bd0 Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 8 Sep 2001 14:17:53 +0000 Subject: * eval.c (rb_thread_restore_context): save current value of lastline and lastmatch in the thread struct for later restore. * eval.c (rb_thread_save_context): restore lastline and lastmatch. * numeric.c (flo_to_s): should handle negative float value. * class.c (rb_include_module): should check whole ancestors to avoid duplicate module inclusion. * string.c (trnext): should check backslash before updating "now" position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- class.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'class.c') diff --git a/class.c b/class.c index 43bb7b1c14..9f79a56973 100644 --- a/class.c +++ b/class.c @@ -291,7 +291,7 @@ void rb_include_module(klass, module) VALUE klass, module; { - VALUE p; + VALUE p, c; int changed = 0; rb_frozen_class_p(klass); @@ -312,22 +312,20 @@ rb_include_module(klass, module) } OBJ_INFECT(klass, module); + c = klass; while (module) { /* ignore if the module included already in superclasses */ for (p = RCLASS(klass)->super; p; p = RCLASS(p)->super) { if (BUILTIN_TYPE(p) == T_ICLASS && RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) { - if (RCLASS(module)->super) { - rb_include_module(p, RCLASS(module)->super); - } - if (changed) rb_clear_cache(); - return; + goto skip; } } - RCLASS(klass)->super = include_class_new(module, RCLASS(klass)->super); - klass = RCLASS(klass)->super; - module = RCLASS(module)->super; + RCLASS(c)->super = include_class_new(module, RCLASS(c)->super); + c = RCLASS(c)->super; changed = 1; + skip: + module = RCLASS(module)->super; } if (changed) rb_clear_cache(); } -- cgit v1.2.3