summaryrefslogtreecommitdiffstats
path: root/class.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-03 07:19:19 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-03 07:19:19 +0000
commit3b37a6847edb2da6225d9785a4579e0cb603dab1 (patch)
tree02dfc7bab198fc494d9d4f1f3bf1072d292fed66 /class.c
parent361be96e52a2982e5ab1c061efa73fd152446cfd (diff)
downloadruby-3b37a6847edb2da6225d9785a4579e0cb603dab1.tar.gz
ruby-3b37a6847edb2da6225d9785a4579e0cb603dab1.tar.xz
ruby-3b37a6847edb2da6225d9785a4579e0cb603dab1.zip
* marshal.c (r_object): better allocation type check for
TYPE_UCLASS. usage of allocation framework is disabled for now. * variable.c (rb_class_path): Module may have subclass. * string.c (rb_str_update): should maintain original negative offset. * string.c (rb_str_subpat_set): ditto * string.c (rb_str_aset): ditto. * re.c (rb_reg_nth_match): should check negative nth. * re.c (rb_reg_nth_defined): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/class.c b/class.c
index 9f79a5697..a7911e8b9 100644
--- a/class.c
+++ b/class.c
@@ -62,19 +62,18 @@ VALUE
rb_mod_clone(module)
VALUE module;
{
- NEWOBJ(clone, struct RClass);
- CLONESETUP(clone, module);
+ VALUE clone = rb_obj_clone(module);
- clone->super = RCLASS(module)->super;
+ RCLASS(clone)->super = RCLASS(module)->super;
if (RCLASS(module)->iv_tbl) {
- clone->iv_tbl = st_copy(RCLASS(module)->iv_tbl);
+ RCLASS(clone)->iv_tbl = st_copy(RCLASS(module)->iv_tbl);
}
if (RCLASS(module)->m_tbl) {
- clone->m_tbl = st_init_numtable();
- st_foreach(RCLASS(module)->m_tbl, clone_method, clone->m_tbl);
+ RCLASS(clone)->m_tbl = st_init_numtable();
+ st_foreach(RCLASS(module)->m_tbl, clone_method, RCLASS(clone)->m_tbl);
}
- return (VALUE)clone;
+ return clone;
}
VALUE