summaryrefslogtreecommitdiffstats
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
commit8f043b64fb245bb4ce6748850f77e1ff48d97fa5 (patch)
treef6423e0d2ba1e8d057f18c0cb1b3afb3e83b8562 /hash.c
parente54be5dee0d548d1c1f0990145c98a721e66ede8 (diff)
downloadruby-8f043b64fb245bb4ce6748850f77e1ff48d97fa5.tar.gz
ruby-8f043b64fb245bb4ce6748850f77e1ff48d97fa5.tar.xz
ruby-8f043b64fb245bb4ce6748850f77e1ff48d97fa5.zip
2000-03-15
git-svn-id: http://svn.ruby-lang.org/repos/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 781857aa2..47681b211 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) {