summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-15 09:09:28 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-15 09:09:28 +0000
commitd8f981b972aab02d1432abe1c9cadf0507945e77 (patch)
treef6423e0d2ba1e8d057f18c0cb1b3afb3e83b8562 /hash.c
parent0d3f4a92cf4b6558f19a39d416c08db5e0b64a5f (diff)
2000-03-15
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/hash.c b/hash.c
index 781857a..47681b2 100644
--- a/hash.c
+++ b/hash.c
@@ -223,22 +223,16 @@ rb_hash_s_create(argc, argv, klass)
VALUE hash;
int i;
- if (argc == 1) {
- if (TYPE(argv[0]) == T_HASH) {
- NEWOBJ(hash, struct RHash);
- OBJSETUP(hash, klass, T_HASH);
+ if (argc == 1 && TYPE(argv[0]) == T_HASH) {
+ NEWOBJ(hash, struct RHash);
+ OBJSETUP(hash, klass, T_HASH);
- hash->iter_lev = 0;
- hash->ifnone = Qnil;
- hash->tbl = 0; /* avoid GC crashing */
- hash->tbl = st_copy(RHASH(argv[0])->tbl);
+ hash->iter_lev = 0;
+ hash->ifnone = Qnil;
+ hash->tbl = 0; /* avoid GC crashing */
+ hash->tbl = st_copy(RHASH(argv[0])->tbl);
- return (VALUE)hash;
- }
- else {
- VALUE a = rb_Array(argv[0]);
- return rb_hash_s_create(RARRAY(a)->len, RARRAY(a)->ptr, klass);
- }
+ return (VALUE)hash;
}
if (argc % 2 != 0) {