Reduced duplicate code
This commit is contained in:
parent
1b4d406e3a
commit
7693897a11
7
hash.c
7
hash.c
@ -1801,12 +1801,7 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
|
|||||||
tmp = rb_hash_s_try_convert(Qnil, argv[0]);
|
tmp = rb_hash_s_try_convert(Qnil, argv[0]);
|
||||||
if (!NIL_P(tmp)) {
|
if (!NIL_P(tmp)) {
|
||||||
hash = hash_alloc(klass);
|
hash = hash_alloc(klass);
|
||||||
if (RHASH_AR_TABLE_P(tmp)) {
|
hash_copy(hash, tmp);
|
||||||
ar_copy(hash, tmp);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
RHASH_ST_TABLE_SET(hash, st_copy(RHASH_ST_TABLE(tmp)));
|
|
||||||
}
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user