summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-02 10:03:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-02 10:03:54 +0000
commitb6fe3dae4de7002c2f58bc9cfb993033dff7927d (patch)
treeb017b82c48b45ae98f3ed92acb3863372ed9d77f /hash.c
parenta1d8147e4419d81cd93c664b85f7062c89101c87 (diff)
call initialize
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 0e5abb78ef..4d170873f8 100644
--- a/hash.c
+++ b/hash.c
@@ -205,6 +205,7 @@ hash_s_new(argc, argv, klass)
hash->status = 0;
hash->tbl = 0; /* avoid GC crashing */
hash->tbl = st_init_table_with_size(&objhash, size);
+ obj_call_init((VALUE)hash);
return (VALUE)hash;
}
@@ -213,7 +214,15 @@ static VALUE
hash_new2(klass)
VALUE klass;
{
- return hash_s_new(0, 0, klass);
+ NEWOBJ(hash, struct RHash);
+ OBJSETUP(hash, klass, T_HASH);
+
+ hash->iter_lev = 0;
+ hash->status = 0;
+ hash->tbl = 0; /* avoid GC crashing */
+ hash->tbl = st_init_table(&objhash);
+
+ return (VALUE)hash;
}
VALUE
@@ -241,6 +250,7 @@ hash_s_create(argc, argv, klass)
hash->status = 0;
hash->tbl = 0; /* avoid GC crashing */
hash->tbl = (st_table*)st_copy(RHASH(argv[0])->tbl);
+ obj_call_init((VALUE)hash);
return (VALUE)hash;
}
}
@@ -253,6 +263,7 @@ hash_s_create(argc, argv, klass)
for (i=0; i<argc; i+=2) {
st_insert(RHASH(hash)->tbl, argv[i], argv[i+1]);
}
+ obj_call_init(hash);
return hash;
}