summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--array.c3
-rw-r--r--hash.c2
-rw-r--r--internal.h1
4 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e46ff49664..79f30707fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Oct 8 16:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no
+ block is given.
+
+ * internal.h: define rb_hash_values() as internal API.
+
Tue Oct 8 13:53:21 2013 Masaki Matsushita <glass.saga@gmail.com>
* array.c (rb_ary_uniq): use rb_hash_keys().
diff --git a/array.c b/array.c
index 3998f60afc..7e8617b771 100644
--- a/array.c
+++ b/array.c
@@ -4124,8 +4124,7 @@ rb_ary_uniq(VALUE ary)
return rb_ary_dup(ary);
if (rb_block_given_p()) {
hash = ary_make_hash_by(ary);
- uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
- st_foreach(rb_hash_tbl_raw(hash), push_value, uniq);
+ uniq = rb_hash_values(hash);
}
else {
hash = ary_make_hash(ary);
diff --git a/hash.c b/hash.c
index d65a698fc2..83d179964f 100644
--- a/hash.c
+++ b/hash.c
@@ -1712,7 +1712,7 @@ values_i(VALUE key, VALUE value, VALUE ary)
*
*/
-static VALUE
+VALUE
rb_hash_values(VALUE hash)
{
VALUE ary;
diff --git a/internal.h b/internal.h
index ad710d08d8..690e26c969 100644
--- a/internal.h
+++ b/internal.h
@@ -436,6 +436,7 @@ void rb_gc_writebarrier_remember_promoted(VALUE obj);
struct st_table *rb_hash_tbl_raw(VALUE hash);
#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
VALUE rb_hash_keys(VALUE hash);
+VALUE rb_hash_values(VALUE hash);
/* inits.c */
void rb_call_inits(void);