Skip to content

Commit

Permalink
array.c: use rb_hash_values
Browse files Browse the repository at this point in the history
* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Oct 8, 2013
1 parent 827f4d6 commit 9c6ea2f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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().
Expand Down
3 changes: 1 addition & 2 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,7 @@ values_i(VALUE key, VALUE value, VALUE ary)
*
*/

static VALUE
VALUE
rb_hash_values(VALUE hash)
{
VALUE ary;
Expand Down
1 change: 1 addition & 0 deletions internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9c6ea2f

Please sign in to comment.