summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-08 04:56:50 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-08 04:56:50 +0000
commit41eb48b88d90936c0055aecb855752ed6e15b7fc (patch)
treea53925d9c080a55574e655a56ddf25be12efc944 /array.c
parent1fa5d76ae08d000b8ba9b728b78e5a9d3d308129 (diff)
* array.c (rb_ary_uniq): use rb_hash_keys().
* internal.h: define rb_hash_keys() as internal API. * hash.c (rb_hash_keys): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/array.c b/array.c
index 76289f4..e94eff5 100644
--- a/array.c
+++ b/array.c
@@ -4130,13 +4130,7 @@ rb_ary_uniq(VALUE ary)
}
else {
hash = ary_make_hash(ary);
- uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
- for (i=0; i<RARRAY_LEN(ary); i++) {
- st_data_t vv = (st_data_t)(v = rb_ary_elt(ary, i));
- if (st_delete(rb_hash_tbl_raw(hash), &vv, 0)) {
- rb_ary_push(uniq, v);
- }
- }
+ uniq = rb_hash_keys(hash);
}
ary_recycle_hash(hash);